IterableExtensions<T> extension

on

Properties

firstOrNull → T?

Available on Iterable<T>?, provided by the IterableExtensions extension

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

Available on Iterable<T>?, provided by the IterableExtensions extension

no setter

Methods

any(bool predicate(T element)) bool

Available on Iterable<T>?, provided by the IterableExtensions extension

Returns true if at least one element matches the given predicate.
countWhere(bool predicate(T element)) int

Available on Iterable<T>?, provided by the IterableExtensions extension

Returns count of elements that matches the given predicate. Returns -1 if iterable is null
elementAtOrNull(int? index) → T?

Available on Iterable<T>?, provided by the IterableExtensions extension

filter(bool test(T element)) List<T>

Available on Iterable<T>?, provided by the IterableExtensions extension

Returns a list containing only elements matching the given predicate!
filterNot(bool test(T element)) List<T>

Available on Iterable<T>?, provided by the IterableExtensions extension

Returns a list containing all elements not matching the given predicate!
filterNotNull() List<T>

Available on Iterable<T>?, provided by the IterableExtensions extension

Returns a list containing all elements that are not null
firstWhereOrNull(bool test(T element)) → T?

Available on Iterable<T>?, provided by the IterableExtensions extension

Returns first element by given predicate or null otherwise
forEachIndexed(void action(T element, int index)) → void

Available on Iterable<T>?, provided by the IterableExtensions extension

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>>

Available on Iterable<T>?, provided by the IterableExtensions extension

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>

Available on Iterable<T>?, provided by the IterableExtensions extension

Returns a set containing all elements that are contained by both this set and the specified collection.
isNotNullOrEmpty() bool

Available on Iterable<T>?, provided by the IterableExtensions extension

Returns false if this nullable iterable is either null or empty.
isNullOrEmpty() bool

Available on Iterable<T>?, provided by the IterableExtensions extension

Returns true if this nullable iterable is either null or empty.
mapIndexed<R>(R convert(int index, T element)) Iterable<R>

Available on Iterable<T>?, provided by the IterableExtensions extension

Maps each element and its index to a new value.
subtract(Iterable<T> other) Set<T>

Available on Iterable<T>?, provided by the IterableExtensions extension

Returns a set containing all elements that are contained by this collection and not contained by the specified collection.
take(int n) List<T>

Available on Iterable<T>?, provided by the IterableExtensions extension

Returns a list containing first n elements.
toSet() Set<T>

Available on Iterable<T>?, provided by the IterableExtensions extension

Convert iterable to set
union(Iterable<T> other) Set<T>

Available on Iterable<T>?, provided by the IterableExtensions extension

Returns a set containing all distinct elements from both collections.