Class CollectionHelper
java.lang.Object
org.hibernate.models.internal.util.CollectionHelper
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intstatic final floatstatic final int -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic <T> ArrayList<T> arrayList(int expectedNumberOfElements) static intdetermineProperSizing(int numberOfElements) Determine the proper initial size for a new collection in order for it to hold the given a number of elements.static <T> voidstatic booleanstatic booleanisEmpty(Collection collection) static booleanstatic booleanisNotEmpty(Object[] objects) static booleanisNotEmpty(Collection collection) static booleanisNotEmpty(Map map) static <E> List<E> static intstatic <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.static intsize(Collection collection) static int
-
Field Details
-
DEFAULT_LIST_CAPACITY
public static final int DEFAULT_LIST_CAPACITY- See Also:
-
MINIMUM_INITIAL_CAPACITY
public static final int MINIMUM_INITIAL_CAPACITY- See Also:
-
LOAD_FACTOR
public static final float LOAD_FACTOR- See Also:
-
-
Constructor Details
-
CollectionHelper
public CollectionHelper()
-
-
Method Details
-
isEmpty
-
isNotEmpty
-
isEmpty
-
isNotEmpty
-
isEmpty
-
isNotEmpty
-
size
-
size
-
length
-
arrayList
-
join
-
forEach
-
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
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.
-