public class CollectionUtils extends Object
| Modifier and Type | Method and Description |
|---|---|
static <T> int |
addAll(Collection<T> collection,
T... values)
Add the multiple values into
the specified collection |
static boolean |
equals(Collection<?> one,
Collection<?> another)
Compares the specified collection with another, the main implementation references
AbstractSet |
static <T> T |
first(Collection<T> values)
Take the first element from the specified collection
|
static boolean |
isEmpty(Collection<?> collection)
Return
true if the supplied Collection is null or empty. |
static boolean |
isEmptyMap(Map map)
Return
true if the supplied Map is null or empty. |
static boolean |
isNotEmpty(Collection<?> collection)
Return
true if the supplied Collection is not null or not empty. |
static boolean |
isNotEmptyMap(Map map)
Return
true if the supplied Map is not null or not empty. |
static String |
join(List<String> list,
String separator) |
static List<String> |
join(Map<String,String> map,
String separator) |
static Map<String,List<String>> |
joinAll(Map<String,Map<String,String>> map,
String separator) |
static boolean |
mapEquals(Map<?,?> map1,
Map<?,?> map2) |
static <T> Set<T> |
ofSet(T... values)
Convert to multiple values to be
LinkedHashSet |
static int |
size(Collection<?> collection)
Get the size of the specified
Collection |
static <T> List<T> |
sort(List<T> list) |
static List<String> |
sortSimpleName(List<String> list) |
static Map<String,String> |
split(List<String> list,
String separator) |
static Map<String,Map<String,String>> |
splitAll(Map<String,List<String>> list,
String separator) |
static <K,V> Map<K,V> |
toMap(Object... pairs) |
static Map<String,String> |
toStringMap(String... pairs) |
public static Map<String,Map<String,String>> splitAll(Map<String,List<String>> list, String separator)
public static Map<String,List<String>> joinAll(Map<String,Map<String,String>> map, String separator)
public static boolean isEmpty(Collection<?> collection)
true if the supplied Collection is null or empty.
Otherwise, return false.collection - the Collection to checkpublic static boolean isNotEmpty(Collection<?> collection)
true if the supplied Collection is not null or not empty.
Otherwise, return false.collection - the Collection to checkpublic static boolean isEmptyMap(Map map)
true if the supplied Map is null or empty.
Otherwise, return false.map - the Map to checkpublic static boolean isNotEmptyMap(Map map)
true if the supplied Map is not null or not empty.
Otherwise, return false.map - the Map to checkpublic static <T> Set<T> ofSet(T... values)
LinkedHashSetT - the type of valuesvalues - one or more valuesSetpublic static int size(Collection<?> collection)
Collectioncollection - the specified Collectionpublic static boolean equals(Collection<?> one, Collection<?> another)
AbstractSetone - Collectionanother - Collectiontrue, or falsepublic static <T> int addAll(Collection<T> collection, T... values)
the specified collectionT - the type of valuescollection - the specified collectionvalues - the multiple valuespublic static <T> T first(Collection<T> values)
T - the type of element of collectionvalues - the collection objectnullCopyright © 2011–2020 The Apache Software Foundation. All rights reserved.