IterableBasics<E> extension

Utility extension methods for the native Iterable class.

on

Methods

all(bool test(E)) bool

Available on Iterable<E>, provided by the IterableBasics extension

Alias for Iterable.every.
average(num value(E)) num?

Available on Iterable<E>, provided by the IterableBasics extension

Returns the average of all the values in this iterable, as defined by value.
containsAll(Iterable<E> other, {bool collapseDuplicates = true}) bool

Available on Iterable<E>, provided by the IterableBasics extension

Returns true if every element in other also exists in this.
containsAny(Iterable<E> other) bool

Available on Iterable<E>, provided by the IterableBasics extension

Returns true if this contains at least one element also contained in other.
getRandom({int? seed}) → E?

Available on Iterable<E>, provided by the IterableBasics extension

Returns a random element of this, or null if this is empty.
getRange(int start, int end) Iterable<E>

Available on Iterable<E>, provided by the IterableBasics extension

Returns an Iterable containing the first end elements of this, excluding the first start elements.
max(Comparator<E> compare) → E?

Available on Iterable<E>, provided by the IterableBasics extension

Returns the greatest element of this as ordered by compare, or null if this is empty.
maxBy(Comparable sortKey(E)) → E?

Available on Iterable<E>, provided by the IterableBasics extension

Returns the element of this with the greatest value for sortKey, or null if this is empty.
min(Comparator<E> compare) → E?

Available on Iterable<E>, provided by the IterableBasics extension

Returns the smallest element of this as ordered by compare, or null if this is empty.
minBy(Comparable sortKey(E)) → E?

Available on Iterable<E>, provided by the IterableBasics extension

Returns the element of this with the least value for sortKey, or null if this is empty.
none(bool test(E)) bool

Available on Iterable<E>, provided by the IterableBasics extension

Returns true if no element of this satisfies test.
one(bool test(E)) bool

Available on Iterable<E>, provided by the IterableBasics extension

Returns true if there is exactly one element of this which satisfies test.
sum(num addend(E)) num

Available on Iterable<E>, provided by the IterableBasics extension

Returns the sum of all the values in this iterable, as defined by addend.