RIterator<A> class abstract

A single-use, forward-only iterator over elements of type A.

RIterator is the traversal primitive for all ribs collections. Callers advance it by checking hasNext and then calling next. Each element is produced exactly once — the iterator cannot be reset.

Create instances with the static factory methods:

All transformation methods (map, filter, flatMap, etc.) return lazy iterators — they do not evaluate elements until next is called.

Mixed-in types
Available extensions

Constructors

RIterator()
const

Properties

hashCode int
The hash code for this object.
no setterinherited
hasNext bool
Whether the iterator has a next element.
no setter
isEmpty bool
Whether this collection contains no elements.
no setterinherited
isNotEmpty bool
Whether this collection contains at least one element.
no setterinherited
isTraversableAgain bool
Whether this collection can be traversed more than once.
no setterinherited
iterator RIterator<A>
Returns an RIterator over the elements of this collection.
no setteroverride
knownSize int
Returns the number of elements in this collection, if that number is already known. If not, -1 is returned.
no setterinherited
nonEmpty bool
Whether this collection contains at least one element.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
size int
Returns the number of elements in this collection.
no setterinherited
toDart Iterator<A>
Converts this RIterator to a Dart Iterator.
no setter

Methods

collect<B>(Function1<A, Option<B>> f) RIterator<B>
Returns a new collection by applying f to each element an only keeping results of type Some.
override
collectFirst<B>(Function1<A, Option<B>> f) Option<B>
Applies f to each element of this collection, returning the first element that results in a Some, if any.
inherited
concat(RIterableOnce<A> xs) RIterator<A>
Returns an iterator that first yields all elements of this iterator, then all elements of xs.
copyToArray(Array<A> xs, [int start = 0, int? n]) int
Copies elements into xs starting at start, writing at most n elements (or all remaining capacity when n is omitted).
inherited
corresponds<B>(covariant RIterable<B> that, Function2<A, B, bool> p) bool
Returns true if this collection has the same size as that and each corresponding element from this and that satisfies the given predicate p.
inherited
count(Function1<A, bool> p) int
Return the number of elements in this collection that satisfy the given predicate.
inherited
distinct<B>(Function1<A, B> f) RIterator<A>
Returns an iterator that skips duplicate elements, keeping first occurrence.
distinctBy<B>(Function1<A, B> f) RIterator<A>
Returns an iterator that skips elements whose key f(elem) has already been seen, keeping the first occurrence of each key.
drop(int n) RIterator<A>
Returns a new collection with the first n elements removed.
override
dropWhile(Function1<A, bool> p) RIterator<A>
Returns a new collection with leading elements satisfying p removed.
override
exists(Function1<A, bool> p) bool
Returns true if any element of this collection satisfies the given predicate, false if no elements satisfy it.
inherited
filter(Function1<A, bool> p) RIterator<A>
Returns a new collection containing only elements that satisfy p.
override
filterNot(Function1<A, bool> p) RIterator<A>
Returns a new collection containing only elements that do not satisfy p.
override
find(Function1<A, bool> p) Option<A>
Returns the first element from this collection that satisfies the given predicate p. If no element satisfies p, None is returned.
inherited
flatMap<B>(covariant Function1<A, RIterableOnce<B>> f) RIterator<B>
Returns a new collection by applying f to each element and concatenating the results.
override
foldLeft<B>(B z, Function2<B, A, B> op) → B
Returns a summary value by applying op to all elements of this collection, moving from left to right. The fold uses a seed value of z.
inherited
foldRight<B>(B z, Function2<A, B, B> op) → B
Returns a summary value by applying op to all elements of this collection, moving from right to left. The fold uses a seed value of z.
inherited
forall(Function1<A, bool> p) bool
Returns true if all elements of this collection satisfy the given predicate, false if any elements do not.
inherited
foreach<U>(Function1<A, U> f) → void
Applies f to each element of this collection, discarding any resulting values.
inherited
grouped(int size) RIterator<RSeq<A>>
Returns an iterator of non-overlapping groups of size consecutive elements.
indexOf(A elem, [int from = 0]) Option<int>
Returns Some(index) of the first occurrence of elem at or after from, or None if not found.
indexWhere(Function1<A, bool> p, [int from = 0]) Option<int>
Returns Some(index) of the first element satisfying p at or after from, or None if no such element exists.
map<B>(Function1<A, B> f) RIterator<B>
Returns a new collection by applying f to each element.
override
maxByOption<B>(Function1<A, B> f, Order<B> order) Option<A>
Finds the largest element in this collection by applying f to each element and using the given Order to find the greatest.
inherited
maxOption(Order<A> order) Option<A>
Finds the largest element in this collection according to the given Order.
inherited
minByOption<B>(Function1<A, B> f, Order<B> order) Option<A>
Finds the smallest element in this collection by applying f to each element and using the given Order to find the greatest.
inherited
minOption(Order<A> order) Option<A>
Finds the largest element in this collection according to the given Order.
inherited
mkString({String? start, String? sep, String? end}) String
Returns a String by using each elements toString(), adding sep between each element. If start is defined, it will be prepended to the resulting string. If end is defined, it will be appended to the resulting string.
inherited
next() → A
Returns the next element, advancing the iterator.
noSuchElement([String? message]) → Never
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
padTo(int len, A elem) RIterator<A>
Returns an iterator that yields all elements of this iterator and then elem repeated until the total count reaches len.
patch(int from, RIterator<A> patchElems, int replaced) RIterator<A>
Returns an iterator that replaces replaced elements starting at position from with the elements of patchElems.
product() double

Available on RIterableOnce<double>, provided by the RIterableDoubleOps extension

Returns the product of all elements in this list
product() int

Available on RIterableOnce<int>, provided by the RIterableIntOps extension

Returns the product of all elements in this list
reduce(Function2<A, A, A> op) → A
Reduces this collection to a single value by applying op left to right.
inherited
reduceLeft(Function2<A, A, A> op) → A
Reduces from left to right. Throws if empty.
inherited
reduceLeftOption(Function2<A, A, A> op) Option<A>
Returns a summary values of all elements of this collection by applying f to each element, moving left to right.
inherited
reduceOption(Function2<A, A, A> op) Option<A>
Returns a summary values of all elements of this collection by applying f to each element, moving left to right.
inherited
reduceRight(Function2<A, A, A> op) → A
Reduces from right to left. Throws if empty.
inherited
reduceRightOption(Function2<A, A, A> op) Option<A>
Returns a summary values of all elements of this collection by applying f to each element, moving right to left.
inherited
sameElements(RIterableOnce<A> that) bool
Returns true if this iterator and that produce the same elements in the same order and both exhaust at the same time.
scan<B>(B z, Function2<B, A, B> op) RIterableOnce<B>
Alias for scanLeft.
inherited
scanLeft<B>(B z, Function2<B, A, B> op) RIterator<B>
Returns a new collection of running totals starting with z.
override
slice(int from, int until) RIterator<A>
Returns a new collection containing elements in the range [from, until).
override
sliceIterator(int from, int until) RIterator<A>
sliding(int size, [int step = 1]) RIterator<RSeq<A>>
Returns an iterator of overlapping windows of size elements, advancing by step elements between windows.
span(Function1<A, bool> p) → (RIterator<A>, RIterator<A>)
Returns two collections: elements before and starting from the first element that does not satisfy p.
override
splitAt(int n) → (RIterableOnce<A>, RIterableOnce<A>)
Returns two collections: the first n elements and the remainder.
inherited
sum() double

Available on RIterableOnce<double>, provided by the RIterableDoubleOps extension

Returns the sum of all elements in this list
sum() int

Available on RIterableOnce<int>, provided by the RIterableIntOps extension

Returns the sum of all elements in this list
take(int n) RIterator<A>
Returns a new collection containing only the first n elements.
override
takeWhile(Function1<A, bool> p) RIterator<A>
Returns a new collection of leading elements that satisfy p.
override
tapEach<U>(Function1<A, U> f) RIterableOnce<A>
Applies f to each element in this collection, discarding any results and returns this collection.
inherited
toIList() IList<A>
Returns an IList with the same elements as this collection.
inherited
toIndexedSeq() IndexedSeq<A>
Returns an IndexedSeq with the same elements as this collection.
inherited
toISet() ISet<A>
Returns an ISet with the same elements as this collection, duplicates removed.
inherited
toIVector() IVector<A>
Returns an IVector with the same elements as this collection.
inherited
toList({bool growable = true}) List<A>
Returns a new List with the same elements as this collection.
inherited
toSeq() RSeq<A>
Returns a RSeq with the same elements as this collection.
inherited
toString() String
A string representation of this object.
inherited
zip<B>(RIterableOnce<B> that) RIterator<(A, B)>
Returns an iterator of pairs, stopping when either side is exhausted.
zipAll<B>(RIterableOnce<B> that, A thisElem, B thatElem) RIterator<(A, B)>
Returns an iterator of pairs, padding the shorter side with thisElem or thatElem until both sides are exhausted.
zipWithIndex() RIterator<(A, int)>
Returns an iterator of (element, index) pairs.

Operators

operator ==(Object other) bool
The equality operator.
inherited

Static Methods

empty<A>() RIterator<A>
Returns an iterator that immediately reports hasNext == false.
fill<A>(int len, A elem) RIterator<A>
Returns an iterator that yields elem exactly len times.
fromDart<A>(Iterator<A> it) RIterator<A>
Wraps a Dart Iterator in an RIterator.
iterate<A>(A start, Function1<A, A> f) RIterator<A>
Returns an infinite iterator producing start, f(start), f(f(start)), ….
single<A>(A a) RIterator<A>
Returns an iterator that yields a exactly once.
tabulate<A>(int len, Function1<int, A> f) RIterator<A>
Returns an iterator of length len where element i is f(i).
unfold<A, S>(S initial, Function1<S, Option<(A, S)>> f) RIterator<A>
Returns an iterator produced by an anamorphism.