Class CollectionHelper

java.lang.Object
org.hibernate.models.internal.util.CollectionHelper

public class CollectionHelper extends Object
  • Field Details

  • Constructor Details

    • CollectionHelper

      public CollectionHelper()
  • Method Details

    • isEmpty

      public static boolean isEmpty(Collection collection)
    • isNotEmpty

      public static boolean isNotEmpty(Collection collection)
    • isEmpty

      public static boolean isEmpty(Map map)
    • isNotEmpty

      public static boolean isNotEmpty(Map map)
    • isEmpty

      public static boolean isEmpty(Object[] objects)
    • isNotEmpty

      public static boolean isNotEmpty(Object[] objects)
    • size

      public static int size(Collection collection)
    • size

      public static int size(Map map)
    • length

      public static int length(Object[] array)
    • arrayList

      public static <T> ArrayList<T> arrayList(int expectedNumberOfElements)
    • join

      public static <E> List<E> join(List<E> first, List<E> second)
    • forEach

      public static <T> void forEach(T[] values, Consumer<T> consumer)
    • determineProperSizing

      public static int determineProperSizing(int numberOfElements)
      Determine the proper initial size for a new collection in order for it to hold the given a number of elements. Specifically we want to account for load size and load factor to prevent immediate resizing.
      Parameters:
      numberOfElements - The number of elements to be stored.
      Returns:
      The proper size.
    • linkedMapOfSize

      public static <K, V> LinkedHashMap<K,V> linkedMapOfSize(int size)
      Build a properly sized linked map, especially handling load size and load factor to prevent immediate resizing.

      Especially helpful for copy map contents.

      Parameters:
      size - The size to make the map.
      Returns:
      The sized linked map.