Class CollectionHelper


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

      • 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)
      • asSetIgnoreNull

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

        @SafeVarargs
        public static <T> Set<T> asLinkedHashSet​(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)