public final class CollectionTools
extends java.lang.Object
| Modifier and Type | Method and Description |
|---|---|
static <T> java.util.List<T> |
removeNullElements(java.util.Collection<? extends T> coll)
Gets a list reflecting the designated collection but without
null elements. |
static <K,V> java.util.Map<K,V> |
replaceWithEmptyOrCopy(java.util.Map<K,V> map)
Replaces an empty map by the EMPTY_MAP constant if its size is zero, or
copies its contents into a new
HashMap. |
public static <K,V> java.util.Map<K,V> replaceWithEmptyOrCopy(java.util.Map<K,V> map)
HashMap.map - The map to be either replaced by EMPTY_MAP or to be copied.public static <T> java.util.List<T> removeNullElements(java.util.Collection<? extends T> coll)
null elements. If the
collection itself is null, null will be returned.coll - The collection for which to get a list but without null elements.null elements.