Class IteratorUtil


  • public final class IteratorUtil
    extends java.lang.Object
    Utility methods for Iterators.
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static <T> java.util.Iterator<T> concat​(java.util.Iterator<T>... source)  
      static int count​(java.util.Iterator<?> iterator)  
      static <E> java.util.Iterator<E> empty()  
      static <T> java.util.Iterator<T> filter​(java.util.Iterator<T> iterator, java.util.function.Predicate<? super T> filter)  
      static <T,​R>
      java.util.Iterator<R>
      flatMap​(java.util.Iterator<T> iterator, java.util.function.Function<? super T,​java.util.Iterator<? extends R>> mapper)  
      static <T,​R>
      java.util.Iterator<R>
      map​(java.util.Iterator<T> iterator, java.util.function.Function<? super T,​? extends R> mapper)  
      static <E> java.util.Iterator<E> of​(E... elements)  
      static <E> java.util.Iterator<E> singleton​(E element)  
      static <T> java.util.Spliterator<T> spliterator​(java.util.Iterator<T> iterator)  
      static <T> java.util.stream.Stream<T> stream​(java.util.Iterator<T> iterator)  
      static <T> java.util.List<T> toList​(java.util.Iterator<T> iterator)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • empty

        public static <E> java.util.Iterator<E> empty()
      • singleton

        public static <E> java.util.Iterator<E> singleton​(E element)
      • of

        @SafeVarargs
        public static <E> java.util.Iterator<E> of​(E... elements)
      • count

        public static int count​(java.util.Iterator<?> iterator)
      • concat

        @SafeVarargs
        public static <T> java.util.Iterator<T> concat​(java.util.Iterator<T>... source)
      • map

        public static <T,​R> java.util.Iterator<R> map​(java.util.Iterator<T> iterator,
                                                            java.util.function.Function<? super T,​? extends R> mapper)
      • flatMap

        public static <T,​R> java.util.Iterator<R> flatMap​(java.util.Iterator<T> iterator,
                                                                java.util.function.Function<? super T,​java.util.Iterator<? extends R>> mapper)
      • filter

        public static <T> java.util.Iterator<T> filter​(java.util.Iterator<T> iterator,
                                                       java.util.function.Predicate<? super T> filter)
      • spliterator

        public static <T> java.util.Spliterator<T> spliterator​(java.util.Iterator<T> iterator)
      • stream

        public static <T> java.util.stream.Stream<T> stream​(java.util.Iterator<T> iterator)
      • toList

        public static <T> java.util.List<T> toList​(java.util.Iterator<T> iterator)