@ApiStatus.Internal
public final class CollectionUtils
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static interface |
CollectionUtils.Predicate<T>
A simplified copy of Java 8 Predicate.
|
Modifier and Type | Method and Description |
---|---|
static <K,V> @NotNull java.util.Map<K,V> |
filterMapEntries(@NotNull java.util.Map<K,V> map,
@NotNull CollectionUtils.Predicate<java.util.Map.Entry<K,V>> predicate)
Returns a new map which entries match a predicate specified by a parameter.
|
static <T> @Nullable java.util.List<T> |
newArrayList(@Nullable java.util.List<T> list)
Creates a new
ArrayList as a shallow copy of list given by parameter. |
static <K,V> @Nullable java.util.Map<K,V> |
newConcurrentHashMap(@Nullable java.util.Map<K,V> map)
Creates a new
ConcurrentHashMap as a shallow copy of map given by parameter. |
static <K,V> @Nullable java.util.Map<K,V> |
newHashMap(@Nullable java.util.Map<K,V> map)
Creates a new
HashMap as a shallow copy of map given by parameter. |
static int |
size(@NotNull java.lang.Iterable<?> data)
Returns an Iterator size
|
public static int size(@NotNull @NotNull java.lang.Iterable<?> data)
data
- the Iterable@Nullable public static <K,V> @Nullable java.util.Map<K,V> newConcurrentHashMap(@Nullable @Nullable java.util.Map<K,V> map)
ConcurrentHashMap
as a shallow copy of map given by parameter.K
- the type of map keysV
- the type of map valuesmap
- the map to copy@Nullable public static <K,V> @Nullable java.util.Map<K,V> newHashMap(@Nullable @Nullable java.util.Map<K,V> map)
HashMap
as a shallow copy of map given by parameter.K
- the type of map keysV
- the type of map valuesmap
- the map to copyHashMap
or null
if parameter is null
@Nullable public static <T> @Nullable java.util.List<T> newArrayList(@Nullable @Nullable java.util.List<T> list)
ArrayList
as a shallow copy of list given by parameter.T
- the type of list entrieslist
- the list to copyArrayList
or null
if parameter is null
@NotNull public static <K,V> @NotNull java.util.Map<K,V> filterMapEntries(@NotNull @NotNull java.util.Map<K,V> map, @NotNull @NotNull CollectionUtils.Predicate<java.util.Map.Entry<K,V>> predicate)
K
- - map entry key typeV
- - map entry value typemap
- - the map to filterpredicate
- - the predicate