Package org.hibernate.util
Class CollectionHelper
java.lang.Object
org.hibernate.util.CollectionHelper
Various help for handling collections.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Collectionstatic final Liststatic final Mapstatic final floatstatic final int -
Method Summary
Modifier and TypeMethodDescriptionstatic <T> List<T> arrayList(int anticipatedSize) 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 intdetermineProperSizing(Map original) Given a map, determine the proper initial size for a new Map to hold the same number of values.static intdetermineProperSizing(Set original) Given a set, determine the proper initial size for a new set to hold the same number of values.static MapmapOfSize(int size) Build a properly sized map, especially handling load size and load factor to prevent immediate resizing.
-
Field Details
-
MINIMUM_INITIAL_CAPACITY
public static final int MINIMUM_INITIAL_CAPACITY- See Also:
-
LOAD_FACTOR
public static final float LOAD_FACTOR- See Also:
-
EMPTY_LIST
-
EMPTY_COLLECTION
-
EMPTY_MAP
-
-
Method Details
-
mapOfSize
Build a properly sized 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 map.
-
determineProperSizing
Given a map, determine the proper initial size for a new Map to hold the same number of values. Specifically we want to account for load size and load factor to prevent immediate resizing.- Parameters:
original- The original map- Returns:
- The proper size.
-
determineProperSizing
Given a set, determine the proper initial size for a new set to hold the same number of values. Specifically we want to account for load size and load factor to prevent immediate resizing.- Parameters:
original- The original set- Returns:
- The proper size.
-
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.
-
arrayList
-