public final class CollectionHelper extends Object
Modifier and Type | Field and Description |
---|---|
static Collection |
EMPTY_COLLECTION |
static List |
EMPTY_LIST |
static Map |
EMPTY_MAP |
static float |
LOAD_FACTOR |
static int |
MINIMUM_INITIAL_CAPACITY |
Modifier and Type | Method and Description |
---|---|
static <T> List<T> |
arrayList(int anticipatedSize) |
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.
|
static int |
determineProperSizing(Map original)
Given a map, determine the proper initial size for a new Map to hold the same number of values.
|
static int |
determineProperSizing(Set original)
Given a set, determine the proper initial size for a new set to hold the same number of values.
|
static Map |
mapOfSize(int size)
Build a properly sized map, especially handling load size and load factor to prevent immediate resizing.
|
public static final int MINIMUM_INITIAL_CAPACITY
public static final float LOAD_FACTOR
public static final List EMPTY_LIST
public static final Collection EMPTY_COLLECTION
public static final Map EMPTY_MAP
public static Map mapOfSize(int size)
size
- The size to make the map.public static int determineProperSizing(Map original)
original
- The original mappublic static int determineProperSizing(Set original)
original
- The original setpublic static int determineProperSizing(int numberOfElements)
numberOfElements
- The number of elements to be stored.public static <T> List<T> arrayList(int anticipatedSize)
Copyright © 2002-2017 Red Hat Middleware, LLC. All Rights Reserved