Interface ExtendedIterator<T>

    • Method Summary

      All Methods Instance Methods Abstract Methods Default Methods 
      Modifier and Type Method Description
      <X extends T>
      ExtendedIterator<T>
      andThen​(java.util.Iterator<X> other)
      return a new iterator which delivers all the elements of this iterator and then all the elements of the other iterator.
      ExtendedIterator<T> filterDrop​(java.util.function.Predicate<T> f)
      return a new iterator containing only the elements of _this_ which are rejected by the filter _f_.
      ExtendedIterator<T> filterKeep​(java.util.function.Predicate<T> f)
      return a new iterator containing only the elements of _this_ which pass the filter _f_.
      default void forEach​(java.util.function.Consumer<T> action)
      Execute an action on each element of the iterator.
      <U> ExtendedIterator<U> mapWith​(java.util.function.Function<T,​U> map1)
      return a new iterator where each element is the result of applying _map1_ to the corresponding element of _this_.
      default java.util.Optional<T> nextOptional()
      Answer with an Optional.
      T removeNext()
      Answer the next object, and remove it.
      java.util.List<T> toList()
      Answer a list of the [remaining] elements of this iterator, in order, consuming this iterator.
      java.util.Set<T> toSet()
      Answer a set of the [remaining] elements of this iterator, consuming this iterator.
      • Methods inherited from interface java.util.Iterator

        forEachRemaining, hasNext, next, remove
    • Method Detail

      • removeNext

        T removeNext()
        Answer the next object, and remove it. Equivalent to next(); remove().
      • andThen

        <X extends TExtendedIterator<T> andThen​(java.util.Iterator<X> other)
        return a new iterator which delivers all the elements of this iterator and then all the elements of the other iterator. Does not copy either iterator; they are consumed as the result iterator is consumed.
      • filterKeep

        ExtendedIterator<T> filterKeep​(java.util.function.Predicate<T> f)
        return a new iterator containing only the elements of _this_ which pass the filter _f_. The order of the elements is preserved. Does not copy _this_, which is consumed as the result is consumed.
      • filterDrop

        ExtendedIterator<T> filterDrop​(java.util.function.Predicate<T> f)
        return a new iterator containing only the elements of _this_ which are rejected by the filter _f_. The order of the elements is preserved. Does not copy _this_, which is consumed as the result is consumed.
      • mapWith

        <U> ExtendedIterator<U> mapWith​(java.util.function.Function<T,​U> map1)
        return a new iterator where each element is the result of applying _map1_ to the corresponding element of _this_. _this_ is not copied; it is consumed as the result is consumed.
      • forEach

        default void forEach​(java.util.function.Consumer<T> action)
        Execute an action on each element of the iterator. This operation ends and closes the ExtendedIterator even if there is an exception. Shorter name for "Iterator.forEachRemaining", adding exception handling.
      • toList

        java.util.List<T> toList()
        Answer a list of the [remaining] elements of this iterator, in order, consuming this iterator.
      • toSet

        java.util.Set<T> toSet()
        Answer a set of the [remaining] elements of this iterator, consuming this iterator.
      • nextOptional

        default java.util.Optional<T> nextOptional()
        Answer with an Optional. This operation assumes that the ExtendedIterator does not return null for next(). If it does, NullPointerException is thrown.
        • If there is no next, return Optional.empty()
        • If the next object exists, and is not null, return that in the Optional.
        • If the next object exists, and is null, throw NullPointerException