Class CollectionUtil

java.lang.Object
io.deephaven.datastructures.util.CollectionUtil

public class CollectionUtil extends Object
Utility methods for creating collections.
  • 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

      public static final Object[] ZERO_LENGTH_OBJECT_ARRAY
    • ZERO_LENGTH_STRING_ARRAY

      public static final String[] ZERO_LENGTH_STRING_ARRAY
    • ZERO_LENGTH_STRING_ARRAY_ARRAY

      public static final String[][] ZERO_LENGTH_STRING_ARRAY_ARRAY
    • UNIVERSAL_SET

      public static final Set UNIVERSAL_SET
      The universal set (immutable). This set is serializable.
  • Constructor Details

    • CollectionUtil

      public CollectionUtil()
  • Method Details

    • unmodifiableMapFromArray

      public static <K, V> Map<K,V> unmodifiableMapFromArray(Class<K> typeK, Class<V> typeV, Object... data)
    • unmodifiableInvertMap

      public static <K, V> Map<K,V> unmodifiableInvertMap(Map<V,K> sourceMap)
    • unmodifiableSetFromArray

      public static <E> Set<E> unmodifiableSetFromArray(E... data)
    • mapFromArray

      public static <K, V> Map<K,V> mapFromArray(Class<K> typeK, Class<V> typeV, Object... data)
    • mapFromArray

      public static <K, V> Map<K,V> mapFromArray(Class<K> typeK, Class<V> typeV, boolean allowDuplicateKeys, Object... data)
    • invertMap

      public static <K, V> Map<K,V> invertMap(Map<V,K> sourceMap)
    • setFromArray

      public static <E> Set<E> setFromArray(E... data)
    • setFromArray

      public static <TYPE> Set<TYPE> setFromArray(@NotNull @NotNull Class<TYPE> type, @NotNull @NotNull Object... data)
    • listFromArray

      public static <E> List<E> listFromArray(E... data)
    • newSizedHashMap

      public static <K, V> Map<K,V> newSizedHashMap(int nEntries)
      Returns an empty HashMap with a big enough capacity such that the given number of entries can be added without resizing.
    • newSizedLinkedHashMap

      public static <K, V> Map<K,V> newSizedLinkedHashMap(int nEntries)
      Returns an empty LinkedHashMap with a big enough capacity such that the given number of entries can be added without resizing.
    • newSizedHashSet

      public static <E> Set<E> newSizedHashSet(int nEntries)
      Returns an empty HashSet with a big enough capacity such that the given number of entries can be added without resizing.
    • newSizedLinkedHashSet

      public static <E> Set<E> newSizedLinkedHashSet(int nEntries)
      Returns an empty LinkedHashSet with a big enough capacity such that the given number of entries can be added without resizing.
    • convertDoublesToPrimitiveArray

      public static double[] convertDoublesToPrimitiveArray(Collection<Double> collection)
      Converts a List of Doubles to an array of doubles.
    • convertIntegersToPrimitiveArray

      public static int[] convertIntegersToPrimitiveArray(Collection<Integer> collection)
      Converts a Collection of Integers to an array of ints.
    • convertLongsToPrimitiveArray

      public static long[] convertLongsToPrimitiveArray(Collection<Long> collection)
      Converts a Collection of Integers to an array of ints.
    • shuffle

      public static <E> void shuffle(E[] elems, Random random)
      Shuffles the elements in an array.
    • containsNull

      public static <E> boolean containsNull(E[] elems)
      Determines if an array contains a null.
    • universalSet

      public static <T> Set<T> universalSet()
      Returns the universal set (immutable). This set is serializable.