public final class CollectionHelper
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static java.util.Collection |
EMPTY_COLLECTION |
static java.util.List |
EMPTY_LIST |
static java.util.Map |
EMPTY_MAP |
static float |
LOAD_FACTOR |
static int |
MINIMUM_INITIAL_CAPACITY |
Modifier and Type | Method and Description |
---|---|
static <T> java.util.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(java.util.Map original)
Given a map, determine the proper initial size for a new Map to hold the same number of values.
|
static int |
determineProperSizing(java.util.Set original)
Given a set, determine the proper initial size for a new set to hold the same number of values.
|
static java.util.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 java.util.List EMPTY_LIST
public static final java.util.Collection EMPTY_COLLECTION
public static final java.util.Map EMPTY_MAP
public static java.util.Map mapOfSize(int size)
size
- The size to make the map.public static int determineProperSizing(java.util.Map original)
original
- The original mappublic static int determineProperSizing(java.util.Set original)
original
- The original setpublic static int determineProperSizing(int numberOfElements)
numberOfElements
- The number of elements to be stored.public static <T> java.util.List<T> arrayList(int anticipatedSize)
Copyright © 2013. All Rights Reserved.