IterableX<T> extension

Extensions for Iterable.

on

Properties

hasOne bool
Returns true if length of this Iterable is 1.
no setter
isLengthEven bool
Whether length of this Iterable is even.
no setter
isLengthOdd bool
Whether length of this Iterable is odd.
no setter

Methods

count(bool test(T element)) int
Returns the number of elements matching the given test predicate.
ifEmpty(Iterable<T> value) Iterable<T>
Returns this Iterable if it's not empty, otherwise returns value.
mapToList<R>(R toElement(T e), {bool growable = false}) List<R>
Creates a List with all elements of this Iterable modified by toElement.
mapToListWhere<R>(R toElement(T e), bool test(T e), {bool growable = false}) List<R>
Creates a List with all elements of this Iterable that satisfy the predicate test and modified by toElement.
mapToSet<R>(R toElement(T e), {bool modifiable = false}) Set<R>
Creates a Set with all elements of this Iterable modified by toElement.
mapToSetWhere<R>(R toElement(T e), bool test(T e), {bool modifiable = false}) Set<R>
Creates a Set with all elements of this Iterable that satisfy the predicate test and modified by toElement.
toFixedList() List<T>
Creates a fixed-length List containing the elements of this Iterable.
toUnmodifiableList() List<T>
Creates an unmodifiable List containing the elements of this Iterable.
toUnmodifiableSet() Set<T>
Creates an unmodifiable Set containing the elements of this Iterable.