Class ObjIterator<T>

java.lang.Object
com.landawn.abacus.util.ObjIterator<T>
Type Parameters:
T -
All Implemented Interfaces:
Immutable, Iterator<T>
Direct Known Subclasses:
LineIterator, ObjIteratorEx

public abstract class ObjIterator<T> extends Object
Since:
0.9
Author:
Haiyang Li
  • Constructor Details

    • ObjIterator

      public ObjIterator()
  • Method Details

    • empty

      public static <T> ObjIterator<T> empty()
      Type Parameters:
      T -
      Returns:
    • just

      public static <T> ObjIterator<T> just(T val)
      Type Parameters:
      T -
      Parameters:
      val -
      Returns:
    • of

      @SafeVarargs public static <T> ObjIterator<T> of(T... a)
      Type Parameters:
      T -
      Parameters:
      a -
      Returns:
    • of

      public static <T> ObjIterator<T> of(T[] a, int fromIndex, int toIndex)
      Type Parameters:
      T -
      Parameters:
      a -
      fromIndex -
      toIndex -
      Returns:
    • of

      public static <T> ObjIterator<T> of(Iterator<? extends T> iter)
      Type Parameters:
      T -
      Parameters:
      iter -
      Returns:
    • of

      public static <T> ObjIterator<T> of(Collection<? extends T> iterable)
      Type Parameters:
      T -
      Parameters:
      iterable -
      Returns:
    • of

      public static <T> ObjIterator<T> of(Iterable<? extends T> iterable)
      Type Parameters:
      T -
      Parameters:
      iterable -
      Returns:
    • from

      public static <T> ObjIterator<T> from(Supplier<T[]> arraySupplier)
      Lazy evaluation.
      Type Parameters:
      T -
      Parameters:
      arraySupplier -
      Returns:
    • defer

      public static <T> ObjIterator<T> defer(Supplier<? extends Iterator<? extends T>> iteratorSupplier)
      Lazy evaluation.
      Type Parameters:
      T -
      Parameters:
      iteratorSupplier -
      Returns:
    • generate

      public static <T> ObjIterator<T> generate(Supplier<? extends T> supplier)
      Returns an infinite ObjIterator.
      Type Parameters:
      T -
      Parameters:
      supplier -
      Returns:
    • generate

      public static <T> ObjIterator<T> generate(BooleanSupplier hasNext, Supplier<? extends T> supplier)
      Type Parameters:
      T -
      Parameters:
      hasNext -
      supplier -
      Returns:
    • toArray

      public Object[] toArray()
    • toArray

      public <A> A[] toArray(A[] a)
    • toList

      public List<T> toList()
    • filter

      @Beta public ObjIterator<T> filter(Predicate<? super T> filter)
    • map

      @Beta public <U> ObjIterator<U> map(Function<? super T,U> mapper)
    • stream

      public Stream<T> stream()
    • indexed

      @Beta public ObjIterator<Indexed<T>> indexed()
    • indexed

      @Beta public ObjIterator<Indexed<T>> indexed(long startIndex)
    • foreachRemaining

      public <E extends Exception> void foreachRemaining(Throwables.Consumer<? super T,E> action) throws E
      Type Parameters:
      E -
      Parameters:
      action -
      Throws:
      E - the e
    • foreachIndexed

      public <E extends Exception> void foreachIndexed(Throwables.IndexedConsumer<? super T,E> action) throws E
      Type Parameters:
      E -
      Parameters:
      action -
      Throws:
      E - the e
    • remove

      @Deprecated public void remove() throws UnsupportedOperationException
      Deprecated.
      - UnsupportedOperationException
      Specified by:
      remove in interface Iterator<T>
      Throws:
      UnsupportedOperationException
    • toSet

      public Set<T> toSet()
    • toCollection

      public <C extends Collection<T>> C toCollection(Supplier<? extends C> supplier)
      Type Parameters:
      C -
      Parameters:
      supplier -
      Returns:
    • toImmutableList

      public ImmutableList<T> toImmutableList()
    • toImmutableSet

      public ImmutableSet<T> toImmutableSet()