public final class CollectionUtils
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
static java.util.Enumeration |
EMPTY_ENUMERATION
An empty enumeration.
|
| Modifier and Type | Method and Description |
|---|---|
static <T,S extends T> |
addIfNotNull(java.util.List<T> target,
S item)
Adds the specified item to the target list if the item is non-null.
|
static <T> java.util.Enumeration<T> |
emptyEnumeration()
Returns a type safe empty enumeration
|
static <T> java.util.Collection<T> |
emptyIfNull(java.util.Collection<T> source)
Return empty collection when source is null
|
static <K,V> java.util.Map<K,V> |
emptyIfNull(java.util.Map<K,V> source)
Return empty Map when source is null
|
static boolean |
isEmpty(java.util.Collection<?> c)
Checks if a collection is empty (or null)
|
static boolean |
isEmpty(java.util.Map<?,?> map)
Checks if a Map is empty (or null)
|
static boolean |
isNotEmpty(java.util.Collection<?> c)
Checks if a collection is not empty (or not null)
|
static boolean |
isNotEmpty(java.util.Map<?,?> map)
Checks if a Map is not empty (or not null)
|
static <T> void |
multiSort(T[] items,
java.util.Collection<java.util.Comparator<T>> comparators)
Sorts an array of items using one or more comparators.
|
static <T> java.util.Collection<T> |
nullIfEmpty(java.util.Collection<T> source)
Return null when source is null or empty
|
static <K,V> java.util.Map<K,V> |
nullIfEmpty(java.util.Map<K,V> source)
Return null when source is null or empty
|
static int |
sizeOf(java.util.Collection<?> c) |
static <T> T[] |
toArray(java.util.Collection<? extends T> c,
java.lang.Class<T> componentType) |
static <T> java.util.Iterator<T> |
unmodifiableIterator(java.util.Iterator<T> iterator) |
public static final java.util.Enumeration EMPTY_ENUMERATION
public static <T> java.util.Iterator<T> unmodifiableIterator(java.util.Iterator<T> iterator)
iterator - An iterator.public static <T> T[] toArray(java.util.Collection<? extends T> c,
java.lang.Class<T> componentType)
c - A collection.componentType - The array component type.public static boolean isEmpty(java.util.Collection<?> c)
c - A collectionpublic static boolean isNotEmpty(java.util.Collection<?> c)
c - A collectionpublic static boolean isEmpty(java.util.Map<?,?> map)
map - A Mappublic static boolean isNotEmpty(java.util.Map<?,?> map)
map - A Mappublic static <T> java.util.Enumeration<T> emptyEnumeration()
public static int sizeOf(java.util.Collection<?> c)
public static <T> void multiSort(T[] items,
java.util.Collection<java.util.Comparator<T>> comparators)
T - items - comparators - public static <T,S extends T> void addIfNotNull(java.util.List<T> target,
S item)
T - Any typeS - An object derived from Ttarget - The target listitem - The item to be addedpublic static <T> java.util.Collection<T> emptyIfNull(java.util.Collection<T> source)
source - The Collectionpublic static <T> java.util.Collection<T> nullIfEmpty(java.util.Collection<T> source)
source - The Collectionpublic static <K,V> java.util.Map<K,V> emptyIfNull(java.util.Map<K,V> source)
source - The Mappublic static <K,V> java.util.Map<K,V> nullIfEmpty(java.util.Map<K,V> source)
source - The MapCopyright ? Technia AB. All Rights Reserved.