Package io.deephaven.datastructures.util
Class CollectionUtil
java.lang.Object
io.deephaven.datastructures.util.CollectionUtil
Utility methods for creating collections.
-
Field Summary
Modifier and TypeFieldDescriptionstatic final Set
The universal set (immutable).static final byte[]
static final double[]
static final double[][]
static final float[]
static final int[]
static final int[][]
static final long[]
static final Object[]
static final short[]
static final String[]
static final String[][]
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic <E> boolean
containsNull
(E[] elems) Determines if an array contains a null.static double[]
convertDoublesToPrimitiveArray
(Collection<Double> collection) Converts a List of Doubles to an array of doubles.static int[]
convertIntegersToPrimitiveArray
(Collection<Integer> collection) Converts a Collection of Integers to an array of ints.static long[]
convertLongsToPrimitiveArray
(Collection<Long> collection) Converts a Collection of Integers to an array of ints.static <K,
V> Map<K, V> static <E> List<E>
listFromArray
(E... data) static <K,
V> Map<K, V> mapFromArray
(Class<K> typeK, Class<V> typeV, boolean allowDuplicateKeys, Object... data) static <K,
V> Map<K, V> mapFromArray
(Class<K> typeK, Class<V> typeV, Object... data) static <K,
V> Map<K, V> newSizedHashMap
(int nEntries) Returns an emptyHashMap
with a big enough capacity such that the given number of entries can be added without resizing.static <E> Set<E>
newSizedHashSet
(int nEntries) Returns an emptyHashSet
with a big enough capacity such that the given number of entries can be added without resizing.static <K,
V> Map<K, V> newSizedLinkedHashMap
(int nEntries) Returns an emptyLinkedHashMap
with a big enough capacity such that the given number of entries can be added without resizing.static <E> Set<E>
newSizedLinkedHashSet
(int nEntries) Returns an emptyLinkedHashSet
with a big enough capacity such that the given number of entries can be added without resizing.static <TYPE> Set<TYPE>
setFromArray
(@NotNull Class<TYPE> type, @NotNull Object... data) static <E> Set<E>
setFromArray
(E... data) static <E> void
Shuffles the elements in an array.static <T> Set<T>
Returns the universal set (immutable).static <K,
V> Map<K, V> unmodifiableInvertMap
(Map<V, K> sourceMap) static <K,
V> Map<K, V> unmodifiableMapFromArray
(Class<K> typeK, Class<V> typeV, Object... data) static <E> Set<E>
unmodifiableSetFromArray
(E... data)
-
Field Details
-
ZERO_LENGTH_BYTE_ARRAY
public static final byte[] ZERO_LENGTH_BYTE_ARRAY -
ZERO_LENGTH_SHORT_ARRAY
public static final short[] ZERO_LENGTH_SHORT_ARRAY -
ZERO_LENGTH_INT_ARRAY
public static final int[] ZERO_LENGTH_INT_ARRAY -
ZERO_LENGTH_INT_ARRAY_ARRAY
public static final int[][] ZERO_LENGTH_INT_ARRAY_ARRAY -
ZERO_LENGTH_LONG_ARRAY
public static final long[] ZERO_LENGTH_LONG_ARRAY -
ZERO_LENGTH_FLOAT_ARRAY
public static final float[] ZERO_LENGTH_FLOAT_ARRAY -
ZERO_LENGTH_DOUBLE_ARRAY
public static final double[] ZERO_LENGTH_DOUBLE_ARRAY -
ZERO_LENGTH_DOUBLE_ARRAY_ARRAY
public static final double[][] ZERO_LENGTH_DOUBLE_ARRAY_ARRAY -
ZERO_LENGTH_OBJECT_ARRAY
-
ZERO_LENGTH_STRING_ARRAY
-
ZERO_LENGTH_STRING_ARRAY_ARRAY
-
UNIVERSAL_SET
The universal set (immutable). This set is serializable.
-
-
Constructor Details
-
CollectionUtil
public CollectionUtil()
-
-
Method Details
-
unmodifiableMapFromArray
-
unmodifiableInvertMap
-
unmodifiableSetFromArray
-
mapFromArray
-
mapFromArray
-
invertMap
-
setFromArray
-
setFromArray
-
listFromArray
-
newSizedHashMap
Returns an emptyHashMap
with a big enough capacity such that the given number of entries can be added without resizing. -
newSizedLinkedHashMap
Returns an emptyLinkedHashMap
with a big enough capacity such that the given number of entries can be added without resizing. -
newSizedHashSet
Returns an emptyHashSet
with a big enough capacity such that the given number of entries can be added without resizing. -
newSizedLinkedHashSet
Returns an emptyLinkedHashSet
with a big enough capacity such that the given number of entries can be added without resizing. -
convertDoublesToPrimitiveArray
Converts a List of Doubles to an array of doubles. -
convertIntegersToPrimitiveArray
Converts a Collection of Integers to an array of ints. -
convertLongsToPrimitiveArray
Converts a Collection of Integers to an array of ints. -
shuffle
Shuffles the elements in an array. -
containsNull
public static <E> boolean containsNull(E[] elems) Determines if an array contains a null. -
universalSet
Returns the universal set (immutable). This set is serializable.
-