org.hibernate.validator.util
Class CollectionHelper
java.lang.Object
org.hibernate.validator.util.CollectionHelper
public class CollectionHelper
- extends java.lang.Object
Provides some methods for simplified collection instantiation.
- Author:
- Gunnar Morling, Kevin Pollet - SERLI - (kevin.pollet@serli.com)
|
Method Summary |
static
|
asSet(T... ts)
|
static
<T> java.util.ArrayList<T> |
|
newArrayList()
|
static
<T> java.util.ArrayList<T> |
|
newArrayList(int size)
|
static
<T> java.util.ArrayList<T> |
|
newArrayList(java.lang.Iterable<T>... iterables)
|
static
<K,V> java.util.HashMap<K,V> |
|
newHashMap()
|
static
<K,V> java.util.HashMap<K,V> |
|
newHashMap(int size)
|
static
|
newHashSet()
|
static
|
newHashSet(int size)
|
static
<K,V> java.util.Map<K,java.util.List<V>> |
|
partition(java.util.List<V> list,
CollectionHelper.Partitioner<K,V> partitioner)
Creates a map containing the given list's values partitioned by the given
partitioner. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
newHashMap
public static <K,V> java.util.HashMap<K,V> newHashMap()
newHashMap
public static <K,V> java.util.HashMap<K,V> newHashMap(int size)
newHashSet
public static <T> java.util.HashSet<T> newHashSet()
newHashSet
public static <T> java.util.HashSet<T> newHashSet(int size)
newArrayList
public static <T> java.util.ArrayList<T> newArrayList()
newArrayList
public static <T> java.util.ArrayList<T> newArrayList(int size)
newArrayList
public static <T> java.util.ArrayList<T> newArrayList(java.lang.Iterable<T>... iterables)
asSet
public static <T> java.util.Set<T> asSet(T... ts)
partition
public static <K,V> java.util.Map<K,java.util.List<V>> partition(java.util.List<V> list,
CollectionHelper.Partitioner<K,V> partitioner)
- Creates a map containing the given list's values partitioned by the given
partitioner.
- Type Parameters:
K - The key type of the resulting map.V - The element type of the list to be partitioned.- Parameters:
list - The list to be partitioned.partitioner - The partitioner to be used for determining the partitions.
- Returns:
- A map containing the given list's values partitioned by the given
partitioner.
Copyright © 2011 Oracle Corporation. All Rights Reserved.