Package io.vavr.collection
Class IteratorModule.ConcatIterator<T>
- java.lang.Object
-
- io.vavr.collection.AbstractIterator<T>
-
- io.vavr.collection.IteratorModule.ConcatIterator<T>
-
- All Implemented Interfaces:
Foldable<T>,Iterator<T>,Traversable<T>,Value<T>,java.lang.Iterable<T>,java.util.Iterator<T>
- Enclosing interface:
- IteratorModule
public static final class IteratorModule.ConcatIterator<T> extends AbstractIterator<T>
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static classIteratorModule.ConcatIterator.Cell<T>
-
Field Summary
Fields Modifier and Type Field Description private Iterator<T>currprivate booleanhasNextCalculatedprivate IteratorModule.ConcatIterator.Cell<T>lastprivate IteratorModule.ConcatIterator.Cell<T>tail
-
Constructor Summary
Constructors Constructor Description ConcatIterator()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description (package private) voidappend(java.util.Iterator<? extends T> that)Iterator<T>concat(java.util.Iterator<? extends T> that)Returns a newIteratorthat yields the elements of this iterator followed by all elements of the specified iterator.TgetNext()booleanhasNext()-
Methods inherited from class io.vavr.collection.AbstractIterator
next, toString
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface io.vavr.collection.Foldable
fold, reduce, reduceOption
-
Methods inherited from interface io.vavr.collection.Iterator
collect, distinct, distinctBy, distinctBy, distinctByKeepLast, distinctByKeepLast, drop, dropRight, dropUntil, dropWhile, filter, findLast, flatMap, foldRight, get, groupBy, grouped, hasDefiniteSize, head, init, initOption, intersperse, isAsync, isEmpty, isLazy, isSequential, isTraversableAgain, iterator, last, length, map, mapTo, mapToVoid, orElse, orElse, partition, peek, reduceLeft, reduceRight, reject, replace, replaceAll, retainAll, scan, scanLeft, scanRight, slideBy, sliding, sliding, span, stringPrefix, tail, tailOption, take, takeRight, takeUntil, takeWhile, transform, unzip, unzip3, zip, zipAll, zipWith, zipWithIndex, zipWithIndex
-
Methods inherited from interface io.vavr.collection.Traversable
arrangeBy, average, containsAll, count, equals, existsUnique, find, foldLeft, forEachWithIndex, hashCode, headOption, isDistinct, isOrdered, isSingleValued, lastOption, max, maxBy, maxBy, min, minBy, minBy, mkCharSeq, mkCharSeq, mkCharSeq, mkString, mkString, mkString, nonEmpty, product, reduceLeftOption, reduceRightOption, single, singleOption, size, spliterator, sum
-
Methods inherited from interface io.vavr.Value
collect, collect, contains, corresponds, eq, exists, forAll, forEach, getOrElse, getOrElse, getOrElseThrow, getOrElseTry, getOrNull, out, out, stderr, stdout, toArray, toCharSeq, toCompletableFuture, toEither, toEither, toInvalid, toInvalid, toJavaArray, toJavaArray, toJavaArray, toJavaCollection, toJavaList, toJavaList, toJavaMap, toJavaMap, toJavaMap, toJavaOptional, toJavaParallelStream, toJavaSet, toJavaSet, toJavaStream, toLeft, toLeft, toLinkedMap, toLinkedMap, toLinkedSet, toList, toMap, toMap, toOption, toPriorityQueue, toPriorityQueue, toQueue, toRight, toRight, toSet, toSortedMap, toSortedMap, toSortedMap, toSortedMap, toSortedSet, toSortedSet, toStream, toTree, toTree, toTry, toTry, toValid, toValid, toValidation, toValidation, toVector
-
-
-
-
Field Detail
-
tail
private IteratorModule.ConcatIterator.Cell<T> tail
-
last
private IteratorModule.ConcatIterator.Cell<T> last
-
hasNextCalculated
private boolean hasNextCalculated
-
-
Method Detail
-
append
void append(java.util.Iterator<? extends T> that)
-
concat
public Iterator<T> concat(java.util.Iterator<? extends T> that)
Description copied from interface:IteratorReturns a newIteratorthat yields the elements of this iterator followed by all elements of the specified iterator.This method appends the elements from
thatto the end of this iterator, creating a concatenated sequence.Examples:
Iterator.of(1, 2).concat(Iterator.of(3, 4)) // yields 1, 2, 3, 4 Iterator.empty().concat(Iterator.of(1, 2)) // yields 1, 2 Iterator.of(1, 2).concat(Iterator.empty()) // yields 1, 2
- Parameters:
that- the iterator whose elements should be appended- Returns:
- a new iterator containing elements from both iterators
-
hasNext
public boolean hasNext()
-
getNext
public T getNext()
- Specified by:
getNextin classAbstractIterator<T>
-
-