org.hibernate.validator.internal.util

## 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 (C) 2011 SERLI, Hardy Ferentschik

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `static interface` | `CollectionHelper.Partitioner<K,V>`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `static <T> Set<T>` | `asSet(T... ts)`
    `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(Collection<? extends T> s1, Collection<? extends T> s2)`
    `static <T> HashSet<T>` | `newHashSet(int size)`
    `static <T> HashSet<T>` | `newHashSet(Iterable<? extends T> iterable)`
    `static <K,V> Map<K,List<V>>` | `partition(List<V> list, CollectionHelper.Partitioner<K,V> partitioner)` Creates a map containing the given list's values partitioned by the given partitioner.
    `static <K,V> Map<K,Set<V>>` | `partition(Set<V> set, CollectionHelper.Partitioner<K,V> partitioner)` Creates a map containing the given set'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`

- - ### Method Detail

    - #### newHashMap

          public static <K,V> HashMap<K,V> newHashMap()

    - #### newHashMap

          public static <K,V> HashMap<K,V> newHashMap(int size)

    - #### newHashMap

          public static <K,V> HashMap<K,V> newHashMap(Map<K,V> map)

    - #### 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)

    - #### newHashSet

          public static <T> HashSet<T> newHashSet(Collection<? extends T> s1,
                                  Collection<? extends T> s2)

    - #### newHashSet

          public static <T> HashSet<T> newHashSet(Iterable<? extends T> iterable)

    - #### newArrayList

          public static <T> ArrayList<T> newArrayList()

    - #### newArrayList

          public static <T> ArrayList<T> newArrayList(int size)

    - #### newArrayList

          public static <T> ArrayList<T> newArrayList(Iterable<T>... iterables)

    - #### asSet

          public static <T> Set<T> asSet(T... ts)

    - #### partition

          public static <K,V> Map<K,List<V>> partition(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.

    - #### partition

          public static <K,V> Map<K,Set<V>> partition(Set<V> set,
                                      CollectionHelper.Partitioner<K,V> partitioner)

      Creates a map containing the given set's values partitioned by the given partitioner.
      Type Parameters:
        `K` - The key type of the resulting map.
        `V` - The element type of the set to be partitioned.
      Parameters:
        `set` - The set to be partitioned.
        `partitioner` - The partitioner to be used for determining the partitions.
      Returns:
        A map containing the given set's values partitioned by the given partitioner.

Copyright © 2007-2014 Red Hat, Inc. All Rights Reserved