Class CollectionUtil


  • public class CollectionUtil
    extends Object
    • Method Detail

      • asIterator

        public static Iterator<?> asIterator​(Object o)
        Parameters:
        o -
        Returns:
        Since:
        1.6
      • equalsIgnoreOrder

        public static boolean equalsIgnoreOrder​(Collection<?> c1,
                                                Collection<?> c2)
        Parameters:
        c1 -
        c2 -
        Returns:
        Since:
        1.6
      • composeArrayListFrom

        @SafeVarargs
        public static <T> ArrayList<T> composeArrayListFrom​(Collection<T>... collections)
        Parameters:
        collections -
        Returns:
        Since:
        1.6
      • mergeCollectionsUnique

        public static <T,​C extends Collection<T>> C mergeCollectionsUnique​(Collection<T> c1,
                                                                                 Collection<T> c2,
                                                                                 Supplier<? extends C> newCollection)
        Parameters:
        c1 -
        c2 -
        newCollection -
        Returns:
        Since:
        1.6
      • addCapacityIfArrayList

        public static void addCapacityIfArrayList​(Collection<?> collection,
                                                  int additionalCapacity)
        Parameters:
        collection -
        additionalCapacity -
        Since:
        1.6
      • asCollection

        public static <T> Collection<T> asCollection​(T o)
      • asList

        public static <T> List<T> asList​(T o)
      • asSet

        public static <T> Set<T> asSet​(T o)
      • createDefaultSet

        public static <T> Set<T> createDefaultSet()
      • createDefaultList

        public static <T> List<T> createDefaultList()
      • iterate

        public static <T> List<T> iterate​(Iterable<T> iterable)
      • toArray

        public static <E> E[] toArray​(Collection<E> c,
                                      Class<?> arrayType)