public final class CollectionHelper extends Object
Modifier and Type | Method and Description |
---|---|
static <T> Set<T> |
asSet(T... ts) |
static Iterable<?> |
iterableFromArray(Object object)
Builds an
Iterable for a given array. |
static Iterator<?> |
iteratorFromArray(Object object)
Builds an
Iterator for a given array. |
static <T> ArrayList<T> |
newArrayList() |
static <T> ArrayList<T> |
newArrayList(int size) |
static <T> ArrayList<T> |
newArrayList(Iterable<T>... iterables) |
static <K,V> ConcurrentHashMap<K,V> |
newConcurrentHashMap() |
static <K,V> HashMap<K,V> |
newHashMap() |
static <K,V> HashMap<K,V> |
newHashMap(int size) |
static <K,V> HashMap<K,V> |
newHashMap(Map<K,V> map) |
static <T> HashSet<T> |
newHashSet() |
static <T> HashSet<T> |
newHashSet(Collection<? extends T> c) |
static <T> HashSet<T> |
newHashSet(int size) |
static <T> HashSet<T> |
newHashSet(Iterable<? extends T> iterable) |
static <T> List<T> |
toImmutableList(List<? extends T> list) |
static <K,V> Map<K,V> |
toImmutableMap(Map<K,V> map) |
static <T> Set<T> |
toImmutableSet(Set<? extends T> set) |
public static <K,V> HashMap<K,V> newHashMap()
public static <K,V> HashMap<K,V> newHashMap(int size)
public static <K,V> ConcurrentHashMap<K,V> newConcurrentHashMap()
public static <T> HashSet<T> newHashSet()
public static <T> HashSet<T> newHashSet(int size)
public static <T> HashSet<T> newHashSet(Collection<? extends T> c)
public static <T> ArrayList<T> newArrayList()
public static <T> ArrayList<T> newArrayList(int size)
@SafeVarargs public static <T> ArrayList<T> newArrayList(Iterable<T>... iterables)
@SafeVarargs public static <T> Set<T> asSet(T... ts)
public static Iterator<?> iteratorFromArray(Object object)
Iterator
for a given array. It is (un)necessarily ugly because we have to deal with array of primitives.object
- a given arrayIterator
iterating over the arrayCopyright © 2019 JBoss by Red Hat. All rights reserved.