Class CollectionHelper

java.lang.Object
org.hibernate.search.util.common.impl.CollectionHelper

public final class CollectionHelper extends Object
Provides some methods for simplified collection instantiation.
Author:
Gunnar Morling, Hardy Ferentschik
  • Method Details

    • newHashMap

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

      public static <K, V> LinkedHashMap<K,V> newLinkedHashMap(int size)
    • newHashSet

      public static <T> HashSet<T> newHashSet(int size)
    • newLinkedHashSet

      public static <T> LinkedHashSet<T> newLinkedHashSet(int size)
    • asSet

      @SafeVarargs public static <T> Set<T> asSet(T... ts)
    • asSetIgnoreNull

      @SafeVarargs public static <T> Set<T> asSetIgnoreNull(T... ts)
    • asLinkedHashSet

      @SafeVarargs public static <T> Set<T> asLinkedHashSet(T... ts)
    • asTreeSet

      @SafeVarargs public static <T> Set<T> asTreeSet(T... ts)
    • asImmutableSet

      @SafeVarargs public static <T> Set<T> asImmutableSet(T... items)
    • asList

      @SafeVarargs public static <T> List<T> asList(T firstItem, T... otherItems)
    • asImmutableList

      @SafeVarargs public static <T> List<T> asImmutableList(T... items)
    • toImmutableList

      public static <T> List<T> toImmutableList(List<? extends T> list)
    • toImmutableSet

      public static <T> Set<T> toImmutableSet(Set<? extends T> set)
    • toImmutableMap

      public static <K, V> Map<K,V> toImmutableMap(Map<K,V> map)
    • flattenAsSet

      public static <T> Set<? extends T> flattenAsSet(Collection<? extends Collection<? extends T>> input)
    • isSubset

      public static <T> boolean isSubset(Set<T> subset, Set<T> superset)
      Returns:
      Whether all elements that are present in the first set are available in the second one.
    • notInTheOtherSet

      public static <T> Set<T> notInTheOtherSet(Set<T> subset, Set<T> superset)