public class CollectionsFactory extends Object
Modifier and Type | Class and Description |
---|---|
static class |
CollectionsFactory.Mode
Constants denoting what type of collections are
currently returned by the factory. |
static class |
CollectionsFactory.ModeScope |
Modifier and Type | Field and Description |
---|---|
private static ThreadLocal<CollectionsFactory.Mode> |
tl |
Constructor and Description |
---|
CollectionsFactory() |
Modifier and Type | Method and Description |
---|---|
static CollectionsFactory.ModeScope |
changeMode(CollectionsFactory.Mode mode)
Updates the mode for the current thread.
|
static CollectionsFactory.Mode |
getMode()
Gets the current mode determining the type of collection objects created by this factory.
|
static <K,V> Map<K,V> |
newIdentityMap() |
static <K,V> Map<K,V> |
newIdentityMap(int expectedMaxSize) |
static <K,V> Map<K,V> |
newIdentityMap(Map<K,V> m) |
static <K,V> HashMap<K,V> |
newMap() |
static <K,V> HashMap<K,V> |
newMap(int initialCapacity) |
static <K,V> HashMap<K,V> |
newMap(Map<K,V> m) |
static <E> Set<E> |
newSet()
Creates a set.
|
static <E> Set<E> |
newSet(Collection<? extends E> c) |
private static final ThreadLocal<CollectionsFactory.Mode> tl
public CollectionsFactory()
public static CollectionsFactory.Mode getMode()
public static CollectionsFactory.ModeScope changeMode(CollectionsFactory.Mode mode)
public static <K,V> Map<K,V> newIdentityMap()
public static <K,V> Map<K,V> newIdentityMap(int expectedMaxSize)
public static <K,V> Map<K,V> newIdentityMap(Map<K,V> m)
public static <E> Set<E> newSet()
CollectionsFactory.Mode.DETERMINISTIC_ITERATION_ORDER
collections, the returned set will have an
iteration order determined by the order in which elements are inserted in the set.public static <E> Set<E> newSet(Collection<? extends E> c)
newSet()