You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@shiro.apache.org by lh...@apache.org on 2010/01/14 21:25:48 UTC
svn commit: r899398 -
/incubator/shiro/trunk/core/src/main/java/org/apache/shiro/util/CollectionUtils.java
Author: lhazlewood
Date: Thu Jan 14 20:25:42 2010
New Revision: 899398
URL: http://svn.apache.org/viewvc?rev=899398&view=rev
Log:
Used native Java generics-inferred Collections methods where possible instead of re-implementing.
Modified:
incubator/shiro/trunk/core/src/main/java/org/apache/shiro/util/CollectionUtils.java
Modified: incubator/shiro/trunk/core/src/main/java/org/apache/shiro/util/CollectionUtils.java
URL: http://svn.apache.org/viewvc/incubator/shiro/trunk/core/src/main/java/org/apache/shiro/util/CollectionUtils.java?rev=899398&r1=899397&r2=899398&view=diff
==============================================================================
--- incubator/shiro/trunk/core/src/main/java/org/apache/shiro/util/CollectionUtils.java (original)
+++ incubator/shiro/trunk/core/src/main/java/org/apache/shiro/util/CollectionUtils.java Thu Jan 14 20:25:42 2010
@@ -41,15 +41,13 @@
* @param clazz the class of the collection type to return
* @return an empty collection
*/
- @SuppressWarnings({"unchecked", "UnusedDeclaration"})
public static <E> Collection<E> emptyCollection(Class<E> clazz) {
- return Collections.EMPTY_SET;
+ return Collections.emptySet();
}
- @SuppressWarnings({"unchecked"})
public static <E> Set<E> asSet(E... elements) {
if (elements == null || elements.length == 0) {
- return Collections.EMPTY_SET;
+ return Collections.emptySet();
}
LinkedHashSet<E> set = new LinkedHashSet<E>(elements.length * 4 / 3 + 1);
Collections.addAll(set, elements);
@@ -95,10 +93,9 @@
return principals == null || principals.isEmpty();
}
- @SuppressWarnings({"unchecked"})
public static <E> List<E> asList(E... elements) {
if (elements == null || elements.length == 0) {
- return Collections.EMPTY_LIST;
+ return Collections.emptyList();
}
// Avoid integer overflow when a large array is passed in
int capacity = computeListCapacity(elements.length);