Package org.apache.shiro.util
Class CollectionUtils
- java.lang.Object
-
- org.apache.shiro.util.CollectionUtils
-
public class CollectionUtils extends Object
Static helper class for use dealing with Collections.- Since:
- 0.9
-
-
Constructor Summary
Constructors Constructor Description CollectionUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Deprecated Methods Modifier and Type Method Description static <E> List<E>asList(E... elements)static <E> Set<E>asSet(E... elements)static booleanisEmpty(Collection c)static booleanisEmpty(Map m)static booleanisEmpty(PrincipalCollection principals)Deprecated.Use PrincipalCollection.isEmpty() directly.static intsize(Collection c)Returns the size of the specified collection or0if the collection isnull.static intsize(Map m)Returns the size of the specified map or0if the map isnull.
-
-
-
Method Detail
-
asSet
public static <E> Set<E> asSet(E... elements)
-
isEmpty
public static boolean isEmpty(Collection c)
- Parameters:
c- the collection to check- Returns:
trueif the specifiedCollectionisnullorempty,falseotherwise.- Since:
- 1.0
-
isEmpty
public static boolean isEmpty(Map m)
- Parameters:
m- theMapto check- Returns:
trueif the specifiedMapisnullorempty,falseotherwise.- Since:
- 1.0
-
size
public static int size(Collection c)
Returns the size of the specified collection or0if the collection isnull.- Parameters:
c- the collection to check- Returns:
- the size of the specified collection or
0if the collection isnull. - Since:
- 1.2
-
size
public static int size(Map m)
Returns the size of the specified map or0if the map isnull.- Parameters:
m- the map to check- Returns:
- the size of the specified map or
0if the map isnull. - Since:
- 1.2
-
isEmpty
@Deprecated public static boolean isEmpty(PrincipalCollection principals)
Deprecated.Use PrincipalCollection.isEmpty() directly.- Parameters:
principals- the principals to check.- Returns:
trueif the specifiedPrincipalCollectionisnullorempty,falseotherwise.- Since:
- 1.0
-
asList
public static <E> List<E> asList(E... elements)
-
-