Package org.python.util
Class Generic
java.lang.Object
org.python.util.Generic
Static methods to make instances of collections with their generic types inferred from what
they're being assigned to. The idea is stolen from
Sets
, Lists
and
Maps
from Google
Collections.-
Field Summary
Modifier and TypeFieldDescriptionstatic final int
static final int
Our default ConcurrentHashMap sizes.static final float
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic <K,
V> ConcurrentMap<K, V> Makes a ConcurrentMap using generic types inferred from whatever this is being assigned to.static <E> Set<E>
Makes a Set, ensuring safe concurrent operations, using generic types inferred from whatever this is being assigned to.static <K,
V> Map<K, V> Makes an IdentityHashMap using generic types inferred from whatever this is being assigned to.static <K,
V> Map<K, V> identityHashMap
(int capacity) Makes an IdentityHashMap using generic types inferred from whatever this is being assigned to.static <E> Set<E>
Makes a LinkedHashSet using the generic type inferred from whatever this is being assigned to.static <E> Set<E>
linkedHashSet
(int capacity) Makes a LinkedHashSet using the generic type inferred from whatever this is being assigned to.static <T> List<T>
list()
Makes a List with its generic type inferred from whatever it's being assigned to.static <T> List<T>
list
(int capacity) Makes a List with its generic type inferred from whatever it's being assigned to.static <T,
U extends T>
List<T>list
(U... contents) Makes a List with its generic type inferred from whatever it's being assigned to filled with the items incontents
.static <K,
V> Map<K, V> map()
Makes a Map using generic types inferred from whatever this is being assigned to.static <E> Set<E>
set()
Makes a Set using the generic type inferred from whatever this is being assigned to.static <T,
U extends T>
Set<T>set
(U... contents) Makes a Set using the generic type inferred from whatever this is being assigned to filled with the items incontents
.
-
Field Details
-
CHM_INITIAL_CAPACITY
public static final int CHM_INITIAL_CAPACITYOur default ConcurrentHashMap sizes. Only concurreny level differs from ConcurrentHashMap's defaults: it's significantly lower to reduce allocation cost.- See Also:
-
CHM_LOAD_FACTOR
public static final float CHM_LOAD_FACTOR- See Also:
-
CHM_CONCURRENCY_LEVEL
public static final int CHM_CONCURRENCY_LEVEL- See Also:
-
-
Constructor Details
-
Generic
public Generic()
-
-
Method Details
-
list
Makes a List with its generic type inferred from whatever it's being assigned to. -
list
Makes a List with its generic type inferred from whatever it's being assigned to. Sets initial capacity accordingly. -
list
Makes a List with its generic type inferred from whatever it's being assigned to filled with the items incontents
. -
map
Makes a Map using generic types inferred from whatever this is being assigned to. -
identityHashMap
Makes an IdentityHashMap using generic types inferred from whatever this is being assigned to. -
identityHashMap
Makes an IdentityHashMap using generic types inferred from whatever this is being assigned to. Sets initial capacity accordingly. -
concurrentMap
Makes a ConcurrentMap using generic types inferred from whatever this is being assigned to. -
set
Makes a Set using the generic type inferred from whatever this is being assigned to. -
linkedHashSet
Makes a LinkedHashSet using the generic type inferred from whatever this is being assigned to. -
linkedHashSet
Makes a LinkedHashSet using the generic type inferred from whatever this is being assigned to. Sets initial capacity accordingly. -
set
Makes a Set using the generic type inferred from whatever this is being assigned to filled with the items incontents
. -
concurrentSet
Makes a Set, ensuring safe concurrent operations, using generic types inferred from whatever this is being assigned to.
-