Class CollectionHelper
- java.lang.Object
-
- org.hibernate.validator.internal.util.CollectionHelper
-
public final class CollectionHelper extends Object
Provides some methods for simplified collection instantiation.- Author:
- Gunnar Morling, Kevin Pollet <kevin.pollet@serli.com> (C) 2011 SERLI, Hardy Ferentschik, Guillaume Smet
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static <T> Set<T>asSet(T... ts)static Iterable<?>iterableFromArray(Object object)Builds anIterablefor a given array.static Iterator<?>iteratorFromArray(Object object)Builds anIteratorfor 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(int size)static <T> HashSet<T>newHashSet(Iterable<? extends T> iterable)static <T> HashSet<T>newHashSet(Collection<? extends T> c)static <T> LinkedHashSet<T>newLinkedHashSet()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)
-
-
-
Method Detail
-
newHashMap
public static <K,V> HashMap<K,V> newHashMap()
-
newHashMap
public static <K,V> HashMap<K,V> newHashMap(int size)
-
newConcurrentHashMap
public static <K,V> ConcurrentHashMap<K,V> newConcurrentHashMap()
-
newHashSet
public static <T> HashSet<T> newHashSet()
-
newHashSet
public static <T> HashSet<T> newHashSet(int size)
-
newHashSet
public static <T> HashSet<T> newHashSet(Collection<? extends T> c)
-
newLinkedHashSet
public static <T> LinkedHashSet<T> newLinkedHashSet()
-
newArrayList
public static <T> ArrayList<T> newArrayList()
-
newArrayList
public static <T> ArrayList<T> newArrayList(int size)
-
newArrayList
@SafeVarargs public static <T> ArrayList<T> newArrayList(Iterable<T>... iterables)
-
asSet
@SafeVarargs public static <T> Set<T> asSet(T... ts)
-
iteratorFromArray
public static Iterator<?> iteratorFromArray(Object object)
Builds anIteratorfor a given array. It is (un)necessarily ugly because we have to deal with array of primitives.- Parameters:
object- a given array- Returns:
- an
Iteratoriterating over the array
-
-