IterableExtensions<T> extension

on

Properties

firstOrNull → T?
Returns first element or null otherwise
no setter
lastOrNull → T?
no setter

Methods

any(bool predicate(T element)) bool
Returns true if at least one element matches the given predicate.
countWhere(bool predicate(T element)) int
Returns count of elements that matches the given predicate. Returns -1 if iterable is null
elementAtOrNull(int? index) → T?
filter(bool test(T element)) List<T>
Returns a list containing only elements matching the given predicate!
filterNot(bool test(T element)) List<T>
Returns a list containing all elements not matching the given predicate!
filterNotNull() List<T>
Returns a list containing all elements that are not null
firstWhereOrNull(bool test(T element)) → T?
Returns first element by given predicate or null otherwise
forEachIndexed(void action(T element, int index)) → void
Performs the given action on each element on iterable, providing sequential index with the element. element! the element on the current iteration index! the index of the current iteration
groupBy<T, K>(K keySelector(T e)) Map<K, List<T>>
Groups elements of the original collection by the key returned by the given keySelector function applied to each element and returns a map where each group key is associated with a list of corresponding elements.
intersect(Iterable other) Set<T>
Returns a set containing all elements that are contained by both this set and the specified collection.
isNotNullOrEmpty() bool
Returns false if this nullable iterable is either null or empty.
isNullOrEmpty() bool
Returns true if this nullable iterable is either null or empty.
mapIndexed<R>(R convert(int index, T element)) Iterable<R>
Maps each element and its index to a new value.
subtract(Iterable<T> other) Set<T>
Returns a set containing all elements that are contained by this collection and not contained by the specified collection.
take(int n) List<T>
Returns a list containing first n elements.
toSet() Set<T>
Convert iterable to set
union(Iterable<T> other) Set<T>
Returns a set containing all distinct elements from both collections.