RIterator<A> abstract
abstract class RIterator<A> with RIterableOnce<A>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:
- RIterator.empty — an iterator that immediately reports
hasNext == false - RIterator.single — one element
- RIterator.fill —
lencopies of the same element - RIterator.tabulate —
lenelements computed by index - RIterator.fromDart — wrap a Dart Iterator
- RIterator.iterate — infinite sequence
start, f(start), f(f(start)), … - RIterator.unfold — stateful anamorphism that terminates when
freturns None
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
const RIterator()Implementation
const RIterator();Properties
hashCode no setter inherited
int get hashCodeThe hash code for this object.
A hash code is a single integer which represents the state of the object that affects operator == comparisons.
All objects have hash codes. The default hash code implemented by Object represents only the identity of the object, the same way as the default operator == implementation only considers objects equal if they are identical (see identityHashCode).
If operator == is overridden to use the object state instead, the hash code must also be changed to represent that state, otherwise the object cannot be used in hash based data structures like the default Set and Map implementations.
Hash codes must be the same for objects that are equal to each other according to operator ==. The hash code of an object should only change if the object changes in a way that affects equality. There are no further requirements for the hash codes. They need not be consistent between executions of the same program and there are no distribution guarantees.
Objects that are not equal are allowed to have the same hash code. It is even technically allowed that all instances have the same hash code, but if clashes happen too often, it may reduce the efficiency of hash-based data structures like HashSet or HashMap.
If a subclass overrides hashCode, it should override the operator == operator as well to maintain consistency.
Inherited from Object.
Implementation
external int get hashCode;hasNext no setter
bool get hasNextWhether the iterator has a next element.
Implementation
bool get hasNext;isEmpty no setter inherited
bool get isEmptyWhether this collection contains no elements.
Inherited from RIterableOnce.
Implementation
bool get isEmpty => switch (knownSize) {
-1 => !iterator.hasNext,
0 => true,
_ => false,
};isNotEmpty no setter inherited
bool get isNotEmptyWhether this collection contains at least one element.
Inherited from RIterableOnce.
Implementation
bool get isNotEmpty => !isEmpty;isTraversableAgain no setter inherited
bool get isTraversableAgainWhether this collection can be traversed more than once.
Always false for a bare RIterableOnce; overridden to true by RIterable and its subtypes.
Inherited from RIterableOnce.
Implementation
bool get isTraversableAgain => false;iterator no setter override
RIterator<A> get iteratorReturns an RIterator over the elements of this collection.
Implementation
@override
RIterator<A> get iterator => this;knownSize no setter inherited
int get knownSizeReturns the number of elements in this collection, if that number is already known. If not, -1 is returned.
Inherited from RIterableOnce.
Implementation
int get knownSize => -1;nonEmpty no setter inherited
bool get nonEmptyWhether this collection contains at least one element.
Inherited from RIterableOnce.
Implementation
bool get nonEmpty => !isEmpty;runtimeType no setter inherited
Type get runtimeTypeA representation of the runtime type of the object.
Inherited from Object.
Implementation
external Type get runtimeType;size no setter inherited
int get sizeReturns the number of elements in this collection.
Inherited from RIterableOnce.
Implementation
int get size {
if (knownSize >= 0) {
return knownSize;
} else {
final it = iterator;
var len = 0;
while (it.hasNext) {
len += 1;
it.next();
}
return len;
}
}toDart no setter
Iterator<A> get toDartConverts this RIterator to a Dart Iterator.
Implementation
Iterator<A> get toDart => _RibsIterator(this);Methods
collect() override
Returns a new collection by applying f to each element an only keeping results of type Some.
Implementation
@override
RIterator<B> collect<B>(Function1<A, Option<B>> f) => _CollectIterator(this, f);collectFirst() inherited
Applies f to each element of this collection, returning the first element that results in a Some, if any.
Inherited from RIterableOnce.
Implementation
Option<B> collectFirst<B>(Function1<A, Option<B>> f) {
final it = iterator;
while (it.hasNext) {
final x = f(it.next());
if (x.isDefined) return x;
}
return none();
}concat()
RIterator<A> concat(RIterableOnce<A> xs)Returns an iterator that first yields all elements of this iterator, then all elements of xs.
Implementation
RIterator<A> concat(RIterableOnce<A> xs) => _ConcatIterator(this).concat(xs);copyToArray() inherited
int copyToArray(Array<A> xs, [int start = 0, int? n])Copies elements into xs starting at start, writing at most n elements (or all remaining capacity when n is omitted).
Returns the number of elements actually copied.
Inherited from RIterableOnce.
Implementation
int copyToArray(Array<A> xs, [int start = 0, int? n]) {
final it = iterator;
final end = start + min(n ?? Integer.maxValue, xs.length - start);
var i = start;
while (i < end && it.hasNext) {
xs[i] = it.next();
i += 1;
}
return i - start;
}corresponds() inherited
bool corresponds<B>(RIterable<B> that, bool Function(A, B) p)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 from RIterableOnce.
Implementation
bool corresponds<B>(
covariant RIterable<B> that,
Function2<A, B, bool> p,
) {
final a = iterator;
final b = that.iterator;
while (a.hasNext && b.hasNext) {
if (!p(a.next(), b.next())) return false;
}
return !a.hasNext && !b.hasNext;
}count() inherited
int count(bool Function(A) p)Return the number of elements in this collection that satisfy the given predicate.
Inherited from RIterableOnce.
Implementation
int count(Function1<A, bool> p) {
var res = 0;
final it = iterator;
while (it.hasNext) {
if (p(it.next())) res += 1;
}
return res;
}distinct()
RIterator<A> distinct<B>(B Function(A) f)Returns an iterator that skips duplicate elements, keeping first occurrence.
Implementation
RIterator<A> distinct<B>(Function1<A, B> f) => distinctBy(identity);distinctBy()
RIterator<A> distinctBy<B>(B Function(A) f)Returns an iterator that skips elements whose key f(elem) has already been seen, keeping the first occurrence of each key.
Implementation
RIterator<A> distinctBy<B>(Function1<A, B> f) => _DistinctByIterator(this, f);drop() override
RIterator<A> drop(int n)Returns a new collection with the first n elements removed.
Implementation
@override
RIterator<A> drop(int n) => sliceIterator(n, -1);dropWhile() override
RIterator<A> dropWhile(bool Function(A) p)Returns a new collection with leading elements satisfying p removed.
Implementation
@override
RIterator<A> dropWhile(Function1<A, bool> p) => _DropWhileIterator(this, p);exists() inherited
bool exists(bool Function(A) p)Returns true if any element of this collection satisfies the given predicate, false if no elements satisfy it.
Inherited from RIterableOnce.
Implementation
bool exists(Function1<A, bool> p) {
var res = false;
final it = iterator;
while (!res && it.hasNext) {
res = p(it.next());
}
return res;
}filter() override
RIterator<A> filter(bool Function(A) p)Returns a new collection containing only elements that satisfy p.
Implementation
@override
RIterator<A> filter(Function1<A, bool> p) => _FilterIterator(this, p, false);filterNot() override
RIterator<A> filterNot(bool Function(A) p)Returns a new collection containing only elements that do not satisfy p.
Implementation
@override
RIterator<A> filterNot(Function1<A, bool> p) => _FilterIterator(this, p, true);find() inherited
Option<A> find(bool Function(A) p)Returns the first element from this collection that satisfies the given predicate p. If no element satisfies p, None is returned.
Inherited from RIterableOnce.
Implementation
Option<A> find(Function1<A, bool> p) {
final it = iterator;
while (it.hasNext) {
final a = it.next();
if (p(a)) return Some(a);
}
return none();
}flatMap() override
RIterator<B> flatMap<B>(RIterableOnce<B> Function(A) f)Returns a new collection by applying f to each element and concatenating the results.
Implementation
@override
RIterator<B> flatMap<B>(Function1<A, RIterableOnce<B>> f) => _FlatMapIterator(this, f);foldLeft() inherited
B foldLeft<B>(B z, B Function(B, A) op)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 from RIterableOnce.
Implementation
B foldLeft<B>(B z, Function2<B, A, B> op) {
var result = z;
final it = iterator;
while (it.hasNext) {
result = op(result, it.next());
}
return result;
}foldRight() inherited
B foldRight<B>(B z, B Function(A, B) op)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 from RIterableOnce.
Implementation
B foldRight<B>(B z, Function2<A, B, B> op) => _reversed().foldLeft(z, (b, a) => op(a, b));forall() inherited
bool forall(bool Function(A) p)Returns true if all elements of this collection satisfy the given predicate, false if any elements do not.
Inherited from RIterableOnce.
Implementation
bool forall(Function1<A, bool> p) {
var res = true;
final it = iterator;
while (res && it.hasNext) {
res = p(it.next());
}
return res;
}foreach() inherited
void foreach<U>(U Function(A) f)Applies f to each element of this collection, discarding any resulting values.
Inherited from RIterableOnce.
Implementation
void foreach<U>(Function1<A, U> f) {
final it = iterator;
while (it.hasNext) {
f(it.next());
}
}grouped()
Returns an iterator of non-overlapping groups of size consecutive elements.
Implementation
RIterator<RSeq<A>> grouped(int size) => _GroupedIterator(this, size, size);indexOf()
Option<int> indexOf(A elem, [int from = 0])Returns Some(index) of the first occurrence of elem at or after from, or None if not found.
Implementation
Option<int> indexOf(A elem, [int from = 0]) => indexWhere((a) => a == elem);indexWhere()
Option<int> indexWhere(bool Function(A) p, [int from = 0])Returns Some(index) of the first element satisfying p at or after from, or None if no such element exists.
Implementation
Option<int> indexWhere(Function1<A, bool> p, [int from = 0]) {
var i = max(from, 0);
final dropped = drop(from);
while (dropped.hasNext) {
if (p(dropped.next())) return Some(i);
i += 1;
}
return none();
}map() override
RIterator<B> map<B>(B Function(A) f)Returns a new collection by applying f to each element.
Implementation
@override
RIterator<B> map<B>(Function1<A, B> f) => _MapIterator(this, f);maxByOption() inherited
Finds the largest element in this collection by applying f to each element and using the given Order to find the greatest.
If this collection is empty, None is returned.
Inherited from RIterableOnce.
Implementation
Option<A> maxByOption<B>(Function1<A, B> f, Order<B> order) => _minMaxByOption(f, order.max);maxOption() inherited
Finds the largest element in this collection according to the given Order.
If this collection is empty, None is returned.
Inherited from RIterableOnce.
Implementation
Option<A> maxOption(Order<A> order) => switch (knownSize) {
0 => none(),
_ => _reduceOptionIterator(iterator, order.max),
};minByOption() inherited
Finds the smallest element in this collection by applying f to each element and using the given Order to find the greatest.
If this collection is empty, None is returned.
Inherited from RIterableOnce.
Implementation
Option<A> minByOption<B>(Function1<A, B> f, Order<B> order) => _minMaxByOption(f, order.min);minOption() inherited
Finds the largest element in this collection according to the given Order.
If this collection is empty, None is returned.
Inherited from RIterableOnce.
Implementation
Option<A> minOption(Order<A> order) => switch (knownSize) {
0 => none(),
_ => _reduceOptionIterator(iterator, order.min),
};mkString() inherited
String mkString({String? start, String? sep, String? end})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 from RIterableOnce.
Implementation
String mkString({String? start, String? sep, String? end}) {
if (knownSize == 0) {
return '${start ?? ""}${end ?? ""}';
} else {
return _mkStringImpl(StringBuffer(), start ?? '', sep ?? '', end ?? '');
}
}next()
A next()Returns the next element, advancing the iterator.
Throws UnsupportedError when called on an exhausted iterator.
Implementation
A next();noSuchElement()
Never noSuchElement([String? message])Implementation
@protected
Never noSuchElement([String? message]) =>
throw UnsupportedError(message ?? 'Called "next" on an empty iterator');noSuchMethod() inherited
dynamic noSuchMethod(Invocation invocation)Invoked when a nonexistent method or property is accessed.
A dynamic member invocation can attempt to call a member which doesn't exist on the receiving object. Example:
dynamic object = 1;
object.add(42); // Statically allowed, run-time errorThis invalid code will invoke the noSuchMethod method of the integer 1 with an Invocation representing the .add(42) call and arguments (which then throws).
Classes can override noSuchMethod to provide custom behavior for such invalid dynamic invocations.
A class with a non-default noSuchMethod invocation can also omit implementations for members of its interface. Example:
class MockList<T> implements List<T> {
noSuchMethod(Invocation invocation) {
log(invocation);
super.noSuchMethod(invocation); // Will throw.
}
}
void main() {
MockList().add(42);
}This code has no compile-time warnings or errors even though the MockList class has no concrete implementation of any of the List interface methods. Calls to List methods are forwarded to noSuchMethod, so this code will log an invocation similar to Invocation.method(#add, [42]) and then throw.
If a value is returned from noSuchMethod, it becomes the result of the original invocation. If the value is not of a type that can be returned by the original invocation, a type error occurs at the invocation.
The default behavior is to throw a NoSuchMethodError.
Inherited from Object.
Implementation
@pragma("vm:entry-point")
@pragma("wasm:entry-point")
external dynamic noSuchMethod(Invocation invocation);padTo()
RIterator<A> padTo(int len, A elem)Returns an iterator that yields all elements of this iterator and then elem repeated until the total count reaches len.
If the iterator already has len or more elements, no padding is added.
Implementation
RIterator<A> padTo(int len, A elem) => _PadToIterator(this, len, elem);patch()
Returns an iterator that replaces replaced elements starting at position from with the elements of patchElems.
Implementation
RIterator<A> patch(int from, RIterator<A> patchElems, int replaced) =>
_PatchIterator(this, from, patchElems, replaced);reduce() inherited
A reduce(A Function(A, A) op)Reduces this collection to a single value by applying op left to right.
Throws if the collection is empty.
Inherited from RIterableOnce.
Implementation
A reduce(Function2<A, A, A> op) => reduceLeft(op);reduceLeft() inherited
A reduceLeft(A Function(A, A) op)Reduces from left to right. Throws if empty.
Inherited from RIterableOnce.
Implementation
A reduceLeft(Function2<A, A, A> op) => switch (this) {
final IndexedSeq<A> seq when seq.length > 0 => _foldl(seq, 1, seq[0], op),
_ when knownSize == 0 => throw UnsupportedError('empty.reduceLeft'),
_ => _reduceLeftIterator(() => throw UnsupportedError('empty.reduceLeft'), op),
};reduceLeftOption() inherited
Option<A> reduceLeftOption(A Function(A, A) op)Returns a summary values of all elements of this collection by applying f to each element, moving left to right.
If this collection is empty, None will be returned.
Inherited from RIterableOnce.
Implementation
Option<A> reduceLeftOption(Function2<A, A, A> op) => switch (knownSize) {
0 => none(),
_ => _reduceOptionIterator(iterator, op),
};reduceOption() inherited
Option<A> reduceOption(A Function(A, A) op)Returns a summary values of all elements of this collection by applying f to each element, moving left to right.
If this collection is empty, None will be returned.
Inherited from RIterableOnce.
Implementation
Option<A> reduceOption(Function2<A, A, A> op) => reduceLeftOption(op);reduceRight() inherited
A reduceRight(A Function(A, A) op)Reduces from right to left. Throws if empty.
Inherited from RIterableOnce.
Implementation
A reduceRight(Function2<A, A, A> op) => switch (this) {
final IndexedSeq<A> seq when seq.length > 0 => _foldr(seq, op),
_ when knownSize == 0 => throw UnsupportedError('empty.reduceLeft'),
_ => _reversed().reduceLeft((x, y) => op(y, x)),
};reduceRightOption() inherited
Option<A> reduceRightOption(A Function(A, A) op)Returns a summary values of all elements of this collection by applying f to each element, moving right to left.
If this collection is empty, None will be returned.
Inherited from RIterableOnce.
Implementation
Option<A> reduceRightOption(Function2<A, A, A> op) => switch (knownSize) {
-1 => _reduceOptionIterator(_reversed().iterator, (x, y) => op(y, x)),
0 => none(),
_ => Some(reduceRight(op)),
};sameElements()
bool sameElements(RIterableOnce<A> that)Returns true if this iterator and that produce the same elements in the same order and both exhaust at the same time.
Implementation
bool sameElements(RIterableOnce<A> that) {
final those = that.iterator;
while (hasNext && those.hasNext) {
if (next() != those.next()) return false;
}
// At that point we know that *at least one* iterator has no next element
// If *both* of them have no elements then the collections are the same
return hasNext == those.hasNext;
}scan() inherited
RIterableOnce<B> scan<B>(B z, B Function(B, A) op)Alias for scanLeft.
Inherited from RIterableOnce.
Implementation
RIterableOnce<B> scan<B>(B z, Function2<B, A, B> op) => scanLeft(z, op);scanLeft() override
RIterator<B> scanLeft<B>(B z, B Function(B, A) op)Returns a new collection of running totals starting with z.
The first element of the result is z; each subsequent element is the result of applying op to the previous total and the next element.
Implementation
@override
RIterator<B> scanLeft<B>(B z, Function2<B, A, B> op) => _ScanLeftIterator(this, z, op);slice() override
RIterator<A> slice(int from, int until)Returns a new collection containing elements in the range [from, until).
Implementation
@override
RIterator<A> slice(int from, int until) => sliceIterator(from, max(until, 0));sliceIterator()
RIterator<A> sliceIterator(int from, int until)Implementation
@protected
RIterator<A> sliceIterator(int from, int until) {
final lo = max(from, 0);
final int rest;
if (until < 0) {
rest = -1; // unbounded
} else if (until <= lo) {
rest = 0; // empty
} else {
rest = until - lo; // finite
}
if (rest == 0) {
return RIterator.empty();
} else {
return _SliceIterator(this, lo, rest);
}
}sliding()
Returns an iterator of overlapping windows of size elements, advancing by step elements between windows.
Implementation
RIterator<RSeq<A>> sliding(int size, [int step = 1]) => _GroupedIterator(this, size, step);span() override
Record span(bool Function(A) p)Returns two collections: elements before and starting from the first element that does not satisfy p.
Implementation
@override
(RIterator<A>, RIterator<A>) span(Function1<A, bool> p) => _spanIterator(this, p);splitAt() inherited
Record splitAt(int n)Returns two collections: the first n elements and the remainder.
Inherited from RIterableOnce.
Implementation
(RIterableOnce<A>, RIterableOnce<A>) splitAt(int n) {
final spanner = _Spanner<A>(n);
return span(spanner.call);
}take() override
RIterator<A> take(int n)Returns a new collection containing only the first n elements.
Implementation
@override
RIterator<A> take(int n) => sliceIterator(0, max(n, 0));takeWhile() override
RIterator<A> takeWhile(bool Function(A) p)Returns a new collection of leading elements that satisfy p.
Implementation
@override
RIterator<A> takeWhile(Function1<A, bool> p) => _TakeWhileIterator(this, p);tapEach() inherited
RIterableOnce<A> tapEach<U>(U Function(A) f)Applies f to each element in this collection, discarding any results and returns this collection.
Inherited from RIterableOnce.
Implementation
RIterableOnce<A> tapEach<U>(Function1<A, U> f) {
foreach(f);
return this;
}toIList() inherited
IList<A> toIList()Returns an IList with the same elements as this collection.
Inherited from RIterableOnce.
Implementation
IList<A> toIList() => IList.from(this);toIndexedSeq() inherited
IndexedSeq<A> toIndexedSeq()Returns an IndexedSeq with the same elements as this collection.
Inherited from RIterableOnce.
Implementation
IndexedSeq<A> toIndexedSeq() => IndexedSeq.from(this);toISet() inherited
ISet<A> toISet()Returns an ISet with the same elements as this collection, duplicates removed.
Inherited from RIterableOnce.
Implementation
ISet<A> toISet() => ISet.from(this);toIVector() inherited
IVector<A> toIVector()Returns an IVector with the same elements as this collection.
Inherited from RIterableOnce.
Implementation
IVector<A> toIVector() => IVector.from(this);toList() inherited
List<A> toList({bool growable = true})Returns a new List with the same elements as this collection.
Inherited from RIterableOnce.
Implementation
List<A> toList({bool growable = true}) {
if (growable) {
final it = iterator;
final res = List<A>.empty(growable: true);
while (it.hasNext) {
res.add(it.next());
}
return res;
} else {
final it = iterator;
return List.generate(size, (_) => it.next());
}
}toSeq() inherited
RSeq<A> toSeq()Returns a RSeq with the same elements as this collection.
Inherited from RIterableOnce.
Implementation
RSeq<A> toSeq() => RSeq.from(this);toString() inherited
String toString()A string representation of this object.
Some classes have a default textual representation, often paired with a static parse function (like int.parse). These classes will provide the textual representation as their string representation.
Other classes have no meaningful textual representation that a program will care about. Such classes will typically override toString to provide useful information when inspecting the object, mainly for debugging or logging.
Inherited from Object.
Implementation
external String toString();zip()
RIterator<Record> zip<B>(RIterableOnce<B> that)Returns an iterator of pairs, stopping when either side is exhausted.
Implementation
RIterator<(A, B)> zip<B>(RIterableOnce<B> that) => _ZipIterator(this, that);zipAll()
RIterator<Record> zipAll<B>(RIterableOnce<B> that, A thisElem, B thatElem)Returns an iterator of pairs, padding the shorter side with thisElem or thatElem until both sides are exhausted.
Implementation
RIterator<(A, B)> zipAll<B>(RIterableOnce<B> that, A thisElem, B thatElem) =>
_ZipAllIterator(this, that, thisElem, thatElem);zipWithIndex()
RIterator<Record> zipWithIndex()Returns an iterator of (element, index) pairs.
Implementation
RIterator<(A, int)> zipWithIndex() => _ZipWithIndexIterator(this);Extension Methods
product() extension
double product()Returns the product of all elements in this list
Available on RIterableOnce<A>, provided by the RIterableDoubleOps extension
Implementation
double product() {
var p = 1.0;
final it = iterator;
while (it.hasNext) {
p *= it.next();
}
return p;
}product() extension
int product()Returns the product of all elements in this list
Available on RIterableOnce<A>, provided by the RIterableIntOps extension
Implementation
int product() {
var p = 1;
final it = iterator;
while (it.hasNext) {
p *= it.next();
}
return p;
}sum() extension
double sum()Returns the sum of all elements in this list
Available on RIterableOnce<A>, provided by the RIterableDoubleOps extension
Implementation
double sum() {
var s = 0.0;
final it = iterator;
while (it.hasNext) {
s += it.next();
}
return s;
}sum() extension
int sum()Returns the sum of all elements in this list
Available on RIterableOnce<A>, provided by the RIterableIntOps extension
Implementation
int sum() {
var s = 0;
final it = iterator;
while (it.hasNext) {
s += it.next();
}
return s;
}Operators
operator ==() inherited
bool operator ==(Object other)The equality operator.
The default behavior for all Objects is to return true if and only if this object and other are the same object.
Override this method to specify a different equality relation on a class. The overriding method must still be an equivalence relation. That is, it must be:
Total: It must return a boolean for all arguments. It should never throw.
Reflexive: For all objects
o,o == omust be true.Symmetric: For all objects
o1ando2,o1 == o2ando2 == o1must either both be true, or both be false.Transitive: For all objects
o1,o2, ando3, ifo1 == o2ando2 == o3are true, theno1 == o3must be true.
The method should also be consistent over time, so whether two objects are equal should only change if at least one of the objects was modified.
If a subclass overrides the equality operator, it should override the hashCode method as well to maintain consistency.
Inherited from Object.
Implementation
external bool operator ==(Object other);Static Methods
empty()
RIterator<A> empty<A>()Returns an iterator that immediately reports hasNext == false.
Implementation
static RIterator<A> empty<A>() => _EmptyIterator<A>();fill()
RIterator<A> fill<A>(int len, A elem)Returns an iterator that yields elem exactly len times.
Implementation
static RIterator<A> fill<A>(int len, A elem) => _FillIterator(len, elem);fromDart()
RIterator<A> fromDart<A>(Iterator<A> it)Wraps a Dart Iterator in an RIterator.
Implementation
static RIterator<A> fromDart<A>(Iterator<A> it) => _DartIterator(it);iterate()
RIterator<A> iterate<A>(A start, A Function(A) f)Returns an infinite iterator producing start, f(start), f(f(start)), ….
Implementation
static RIterator<A> iterate<A>(A start, Function1<A, A> f) => _IterateIterator(start, f);single()
RIterator<A> single<A>(A a)Returns an iterator that yields a exactly once.
Implementation
static RIterator<A> single<A>(A a) => _SingleIterator(a);tabulate()
RIterator<A> tabulate<A>(int len, A Function(int) f)Returns an iterator of length len where element i is f(i).
Implementation
static RIterator<A> tabulate<A>(int len, Function1<int, A> f) => _TabulateIterator(len, f);unfold()
Returns an iterator produced by an anamorphism.
Starting from initial, applies f repeatedly. Each call to f must return Some((value, nextState)) to emit value and continue, or None to terminate.
Implementation
static RIterator<A> unfold<A, S>(
S initial,
Function1<S, Option<(A, S)>> f,
) => _UnfoldIterator(initial, f);