public final class CollectionUtils extends Object
| Modifier and Type | Method and Description |
|---|---|
static <E> List<E> |
asList(E... elements)
Converts the vararg argument to to a
List instance. |
static <E> Set<E> |
asSet(E... elements)
Returns the items in the vararg as a
Set but keeping there order by using a LinkedHashSet. |
static boolean |
isEmpty(Collection c)
|
static boolean |
isEmpty(Map m)
|
static int |
size(Collection c)
Returns the size of the specified collection or
0 if the collection is null. |
static int |
size(Map m)
Returns the size of the specified map or
0 if the map is null. |
public static <E> Set<E> asSet(E... elements)
Set but keeping there order by using a LinkedHashSet.
Items must be of the same type.E - The type of the items and the resulting Setelements - items to be placed in Setpublic static boolean isEmpty(Collection c)
c - the collection to checktrue if the specified Collection is null or empty,
false otherwise.public static boolean isEmpty(Map m)
m - the Map to checktrue if the specified Map is null or empty,
false otherwise.public static int size(Collection c)
0 if the collection is null.c - the collection to check0 if the collection is null.public static int size(Map m)
0 if the map is null.m - the map to check0 if the map is null.public static <E> List<E> asList(E... elements)
List instance. The list is a regular list but the initial size is
computed to accomadate exactly the number of items specified by the argument.E - The type of the List items.elements - The elements for the list.List instance.Copyright © 2014–2018. All rights reserved.