IterableBasics<E> extension
Utility extension methods for the native Iterable class.
- on
-
- Iterable<
E>
- Iterable<
Methods
-
all(
bool test(E)) → bool -
Alias for Iterable
.every
. -
average(
num value(E)) → num? -
Returns the average of all the values in this iterable, as defined by
value
. -
containsAll(
Iterable< E> other, {bool collapseDuplicates = true}) → bool -
Returns true if every element in
other
also exists in this. -
containsAny(
Iterable< E> other) → bool -
Returns
true
if this contains at least one element also contained inother
. -
getRandom(
{int? seed}) → E? -
Returns a random element of this, or
null
if this is empty. -
getRange(
int start, int end) → Iterable< E> -
Returns an Iterable containing the first
end
elements of this, excluding the firststart
elements. -
max(
Comparator< E> compare) → E? -
Returns the greatest element of this as ordered by
compare
, ornull
if this is empty. -
maxBy(
Comparable sortKey(E)) → E? -
Returns the element of this with the greatest value for
sortKey
, ornull
if this is empty. -
min(
Comparator< E> compare) → E? -
Returns the smallest element of this as ordered by
compare
, ornull
if this is empty. -
minBy(
Comparable sortKey(E)) → E? -
Returns the element of this with the least value for
sortKey
, ornull
if this is empty. -
none(
bool test(E)) → bool -
Returns
true
if no element of this satisfiestest
. -
one(
bool test(E)) → bool -
Returns
true
if there is exactly one element of this which satisfiestest
. -
sum(
num addend(E)) → num -
Returns the sum of all the values in this iterable, as defined by
addend
.