Class CollectionUtils

    • Method Detail

      • iteratorToList

        public static <I> List<I> iteratorToList​(Iterator<I> iterator)
        Return all items returned by the Iterator as a List.
        Type Parameters:
        I - type
        Parameters:
        iterator - iterator
        Returns:
        list
      • concat

        public static <T> T[] concat​(T t,
                                     T[] ts)
        Return a new array which contains
        t
        as first element, followed by the elements of
        ts
        .
        Type Parameters:
        T - type
        Parameters:
        t - head
        ts - tail
        Returns:
        t and ts as array
      • contains

        public static <T> boolean contains​(T[] ts,
                                           T t)
        Return true, if the given array
        ts
        contains the element
        t
        .
        Type Parameters:
        T - type
        Parameters:
        ts - elements
        t - searched element
        Returns:
        true if ts contains t, false otherwise