Class DesignerIteratorUtil


  • public final class DesignerIteratorUtil
    extends Object
    Since:
    6.11.0
    Author:
    Clément Fournier
    • Method Detail

      • takeWhile

        public static <T> Stream<T> takeWhile​(Stream<T> stream,
                                              Predicate<? super T> predicate)
      • last

        public static <T> T last​(Iterator<T> ts)
      • any

        public static <T> boolean any​(Iterator<? extends T> it,
                                      Predicate<? super T> predicate)
      • toStream

        public static <T> Stream<T> toStream​(Iterator<T> it)
      • toList

        public static <T> List<T> toList​(Iterator<T> it)
      • count

        public static int count​(Iterator<?> it)
        Counts the items in this iterator, exhausting it.
      • asReversed

        public static <T> Iterable<T> asReversed​(List<T> lst)
      • iteratorFrom

        public static <T> Iterator<T> iteratorFrom​(T seed,
                                                   Predicate<T> hasSuccessor,
                                                   Function<T,​T> successorFun,
                                                   boolean includeSeed)
        Gets an iterator with a successor fun.
        Type Parameters:
        T - Type of values
        Parameters:
        seed - Seed item
        hasSuccessor - Tests whether the seed / the last item output has a successor
        successorFun - Successor function
        includeSeed - Whether to include the seed as the first item of the iterator
        Returns:
        An iterator