KtIterableExtensions<T> extension
- on
-
- KtIterable<
T>
- KtIterable<
Properties
-
dart
→ Iterable<
T> -
Available on KtIterable<
Returns a dart:core IterableT> , provided by the KtIterableExtensions extensionno setter
Methods
-
all(
bool predicate(T element)) → bool -
Available on KtIterable<
ReturnsT> , provided by the KtIterableExtensions extensiontrue
if all elements match the givenpredicate
. -
any(
[bool predicate(T element)?]) → bool -
Available on KtIterable<
ReturnsT> , provided by the KtIterableExtensions extensiontrue
if at least one element matches the givenpredicate
. -
asIterable(
) → KtIterable< T> -
Available on KtIterable<
Returns this collection as an Iterable.T> , provided by the KtIterableExtensions extension -
associate<
K, V> (KtPair< K, V> transform(T)) → KtMap<K, V> -
Available on KtIterable<
Returns a Map containing key-value pairs provided byT> , provided by the KtIterableExtensions extensiontransform
function applied to elements of the given collection. -
associateBy<
K> (K keySelector(T)) → KtMap< K, T> -
Available on KtIterable<
Returns a Map containing the elements from the given collection indexed by the key returned fromT> , provided by the KtIterableExtensions extensionkeySelector
function applied to each element. -
associateByTo<
K, V, M extends KtMutableMap< (K, V> >M destination, K keySelector(T), [V valueTransform(T)?]) → M -
Available on KtIterable<
Populates and returns theT> , provided by the KtIterableExtensions extensiondestination
mutable map with key-value pairs, where key is provided by thekeySelector
function and and value is provided by thevalueTransform
function applied to elements of the given collection. -
associateByTransform<
K, V> (K keySelector(T), V valueTransform(T)) → KtMap< K, V> -
Available on KtIterable<
Returns a Map containing the elements from the given collection indexed by the key returned fromT> , provided by the KtIterableExtensions extensionkeySelector
function applied to each element. The element can be transformed withvalueTransform
. -
associateTo<
K, V, M extends KtMutableMap< (K, V> >M destination, KtPair< K, V> transform(T)) → M -
Available on KtIterable<
Populates and returns theT> , provided by the KtIterableExtensions extensiondestination
mutable map with key-value pairs provided bytransform
function applied to each element of the given collection. -
associateWith<
V> (V valueSelector(T)) → KtMap< T, V> -
Available on KtIterable<
Returns a Map where keys are elements from the given collection and values are produced by theT> , provided by the KtIterableExtensions extensionvalueSelector
function applied to each element. -
associateWithTo<
V, M extends KtMutableMap> (M destination, V valueSelector(T)) → M -
Available on KtIterable<
Populates and returns theT> , provided by the KtIterableExtensions extensiondestination
mutable map with key-value pairs for each element of the given collection, where key is the element itself and value is provided by thevalueSelector
function applied to that key. -
averageBy(
num selector(T)) → double -
Available on KtIterable<
Returns an average value produced byT> , provided by the KtIterableExtensions extensionselector
function applied to each element in the collection. -
cast<
R> () → KtIterable< R> -
Available on KtIterable<
Provides a view of this KtIterable as an iterable ofT> , provided by the KtIterableExtensions extensionR
instances. -
chunked(
int size) → KtList< KtList< T> > -
Available on KtIterable<
Splits this collection into a list of lists each not exceeding the givenT> , provided by the KtIterableExtensions extensionsize
. -
chunkedTransform<
R> (int size, R transform(KtList< T> )) → KtList<R> -
Available on KtIterable<
Splits this collection into several lists each not exceeding the givenT> , provided by the KtIterableExtensions extensionsize
and applies the giventransform
function to an each. -
contains(
T element) → bool -
Available on KtIterable<
ReturnsT> , provided by the KtIterableExtensions extensiontrue
ifelement
is found in the collection. -
count(
[bool predicate(T)?]) → int -
Available on KtIterable<
Returns the number of elements matching the givenT> , provided by the KtIterableExtensions extensionpredicate
or the number of elements whenpredicate = null
. -
distinct(
) → KtList< T> -
Available on KtIterable<
Returns a list containing only distinct elements from the given collection.T> , provided by the KtIterableExtensions extension -
distinctBy<
K> (K selector(T)) → KtList< T> -
Available on KtIterable<
Returns a list containing only elements from the given collection having distinct keys returned by the givenT> , provided by the KtIterableExtensions extensionselector
function. -
drop(
int n) → KtList< T> -
Available on KtIterable<
Returns a list containing all elements except firstT> , provided by the KtIterableExtensions extensionn
elements. -
dropWhile(
bool predicate(T)) → KtList< T> -
Available on KtIterable<
Returns a list containing all elements except first elements that satisfy the givenT> , provided by the KtIterableExtensions extensionpredicate
. -
elementAt(
int index) → T -
Available on KtIterable<
Returns an element at the givenT> , provided by the KtIterableExtensions extensionindex
or throws an IndexOutOfBoundsException if theindex
is out of bounds of this collection. -
elementAtOrElse(
int index, T defaultValue(int)) → T -
Available on KtIterable<
Returns an element at the givenT> , provided by the KtIterableExtensions extensionindex
or the result of calling thedefaultValue
function if theindex
is out of bounds of this collection. -
elementAtOrNull(
int index) → T? -
Available on KtIterable<
Returns an element at the givenT> , provided by the KtIterableExtensions extensionindex
ornull
if theindex
is out of bounds of this collection. -
filter(
bool predicate(T)) → KtList< T> -
Available on KtIterable<
Returns a list containing only elements matching the givenT> , provided by the KtIterableExtensions extensionpredicate
. -
filterIndexed(
bool predicate(int index, T)) → KtList< T> -
Available on KtIterable<
Returns a list containing only elements matching the givenT> , provided by the KtIterableExtensions extensionpredicate
. @parampredicate
function that takes the index of an element and the element itself and returns the result of predicate evaluation on the element. -
filterIndexedTo<
C extends KtMutableCollection> (C destination, bool predicate(int index, T)) → C -
Available on KtIterable<
Appends all elements matching the givenT> , provided by the KtIterableExtensions extensionpredicate
to the givendestination
. @parampredicate
function that takes the index of an element and the element itself and returns the result of predicate evaluation on the element. -
filterIsInstance<
R> () → KtList< R> -
Available on KtIterable<
Returns a list containing all elements that are instances of specified type parameter R.T> , provided by the KtIterableExtensions extension -
filterNot(
bool predicate(T)) → KtList< T> -
Available on KtIterable<
Returns a list containing all elements not matching the givenT> , provided by the KtIterableExtensions extensionpredicate
. -
filterNotTo<
C extends KtMutableCollection> (C destination, bool predicate(T)) → C -
Available on KtIterable<
Appends all elements not matching the givenT> , provided by the KtIterableExtensions extensionpredicate
to the givendestination
. -
filterTo<
C extends KtMutableCollection> (C destination, bool predicate(T)) → C -
Available on KtIterable<
Appends all elements matching the givenT> , provided by the KtIterableExtensions extensionpredicate
to the givendestination
. -
find(
bool predicate(T)) → T? -
Available on KtIterable<
Returns the first element matching the givenT> , provided by the KtIterableExtensions extensionpredicate
, ornull
if no such element was found. -
findLast(
bool predicate(T)) → T? -
Available on KtIterable<
Returns the last element matching the givenT> , provided by the KtIterableExtensions extensionpredicate
, ornull
if no such element was found. -
first(
[bool predicate(T)?]) → T -
Available on KtIterable<
Returns first element.T> , provided by the KtIterableExtensions extension -
firstOrNull(
[bool predicate(T)?]) → T? -
Available on KtIterable<
Returns the first element (matchingT> , provided by the KtIterableExtensions extensionpredicate
when provided), ornull
if the collection is empty. -
flatMap<
R> (KtIterable< R> transform(T)) → KtList<R> -
Available on KtIterable<
Returns a single list of all elements yielded from results ofT> , provided by the KtIterableExtensions extensiontransform
function being invoked on each element of original collection. -
flatMapIndexed<
R> (KtIterable< R> transform(int index, T)) → KtList<R> -
Available on KtIterable<
Returns a single list of all elements yielded from results ofT> , provided by the KtIterableExtensions extensiontransform
function being invoked on each element and its index in the original collection. -
flatMapIndexedTo<
R, C extends KtMutableCollection< (R> >C destination, KtIterable< R> transform(int index, T)) → C -
Available on KtIterable<
Appends all elements yielded from results ofT> , provided by the KtIterableExtensions extensiontransform
function being invoked on each element and its index in the original collection, to the givendestination
. -
flatMapTo<
R, C extends KtMutableCollection< (R> >C destination, KtIterable< R> transform(T)) → C -
Available on KtIterable<
Appends all elements yielded from results ofT> , provided by the KtIterableExtensions extensiontransform
function being invoked on each element of original collection, to the givendestination
. -
fold<
R> (R initial, R operation(R acc, T)) → R -
Available on KtIterable<
Accumulates value starting withT> , provided by the KtIterableExtensions extensioninitial
value and applyingoperation
from left to right to current accumulator value and each element. -
foldIndexed<
R> (R initial, R operation(int index, R acc, T)) → R -
Available on KtIterable<
Accumulates value starting withT> , provided by the KtIterableExtensions extensioninitial
value and applyingoperation
from left to right to current accumulator value and each element with its index in the original collection. @paramoperation
function that takes the index of an element, current accumulator value and the element itself, and calculates the next accumulator value. -
forEach(
void action(T element)) → void -
Available on KtIterable<
Performs the givenT> , provided by the KtIterableExtensions extensionaction
on each element. -
forEachIndexed(
void action(int index, T element)) → void -
Available on KtIterable<
Performs the givenT> , provided by the KtIterableExtensions extensionaction
on each element, providing sequential index with the element. @paramaction
function that takes the index of an element and the element itself and performs the desired action on the element. -
groupBy<
K> (K keySelector(T)) → KtMap< K, KtList< T> > -
Available on KtIterable<
Groups elements of the original collection by the key returned by the givenT> , provided by the KtIterableExtensions extensionkeySelector
function applied to each element and returns a map where each group key is associated with a list of corresponding elements. -
groupByTo<
K, M extends KtMutableMap< (K, KtMutableList> >M destination, K keySelector(T)) → M -
Available on KtIterable<
Groups elements of the original collection by the key returned by the givenT> , provided by the KtIterableExtensions extensionkeySelector
function applied to each element and puts to thedestination
map each group key associated with a list of corresponding elements. -
groupByToTransform<
K, V, M extends KtMutableMap< (K, KtMutableList< >V> >M destination, K keySelector(T), V valueTransform(T)) → M -
Available on KtIterable<
Groups values returned by theT> , provided by the KtIterableExtensions extensionvalueTransform
function applied to each element of the original collection by the key returned by the givenkeySelector
function applied to the element and puts to thedestination
map each group key associated with a list of corresponding values. -
groupByTransform<
K, V> (K keySelector(T), V valueTransform(T)) → KtMap< K, KtList< V> > -
Available on KtIterable<
Groups values returned by theT> , provided by the KtIterableExtensions extensionvalueTransform
function applied to each element of the original collection by the key returned by the givenkeySelector
function applied to the element and returns a map where each group key is associated with a list of corresponding values. -
indexOf(
T element) → int -
Available on KtIterable<
Returns first index ofT> , provided by the KtIterableExtensions extensionelement
, or -1 if the collection does not contain element. -
indexOfFirst(
bool predicate(T)) → int -
Available on KtIterable<
Returns index of the first element matching the givenT> , provided by the KtIterableExtensions extensionpredicate
, or -1 if the collection does not contain such element. -
indexOfLast(
bool predicate(T)) → int -
Available on KtIterable<
Returns index of the last element matching the givenT> , provided by the KtIterableExtensions extensionpredicate
, or -1 if the collection does not contain such element. -
intersect(
KtIterable< T> other) → KtSet<T> -
Available on KtIterable<
Returns a set containing all elements that are contained by both this set and the specified collection.T> , provided by the KtIterableExtensions extension -
joinToString(
{String separator = ", ", String prefix = "", String postfix = "", int limit = -1, String truncated = "...", String transform(T)?}) → String -
Available on KtIterable<
Creates a string from all the elements separated usingT> , provided by the KtIterableExtensions extensionseparator
and using the givenprefix
andpostfix
if supplied. -
last(
[bool predicate(T)?]) → T -
Available on KtIterable<
Returns the last element matching the givenT> , provided by the KtIterableExtensions extensionpredicate
. @throws NoSuchElementException if no such element is found. -
lastIndexOf(
T element) → int -
Available on KtIterable<
Returns last index ofT> , provided by the KtIterableExtensions extensionelement
, or -1 if the collection does not contain element. -
lastOrNull(
[bool predicate(T)?]) → T? -
Available on KtIterable<
Returns the last element matching the givenT> , provided by the KtIterableExtensions extensionpredicate
, ornull
if no such element was found. -
map<
R> (R transform(T)) → KtList< R> -
Available on KtIterable<
Returns a list containing the results of applying the givenT> , provided by the KtIterableExtensions extensiontransform
function to each element in the original collection. -
mapIndexed<
R> (R transform(int index, T)) → KtList< R> -
Available on KtIterable<
Returns a list containing the results of applying the givenT> , provided by the KtIterableExtensions extensiontransform
function to each element and its index in the original collection. @paramtransform
function that takes the index of an element and the element itself and returns the result of the transform applied to the element. -
mapIndexedTo<
R, C extends KtMutableCollection< (R> >C destination, R transform(int index, T)) → C -
Available on KtIterable<
Applies the givenT> , provided by the KtIterableExtensions extensiontransform
function to each element and its index in the original collection and appends the results to the givendestination
. @paramtransform
function that takes the index of an element and the element itself and returns the result of the transform applied to the element. -
mapTo<
R, C extends KtMutableCollection< (R> >C destination, R transform(T)) → C -
Available on KtIterable<
Applies the givenT> , provided by the KtIterableExtensions extensiontransform
function to each element of the original collection and appends the results to the givendestination
. -
maxBy<
R extends Comparable> (R selector(T)) → T? -
Available on KtIterable<
Returns the first element yielding the largest value of the given function orT> , provided by the KtIterableExtensions extensionnull
if there are no elements. -
maxOf<
R extends Comparable> (R selector(T)) → R -
Available on KtIterable<
Returns the largest value among all values produced by selector function applied to each element in the collection.T> , provided by the KtIterableExtensions extension -
maxWith(
Comparator< T> comparator) → T? -
Available on KtIterable<
Returns the first element having the largest value according to the providedT> , provided by the KtIterableExtensions extensioncomparator
ornull
if there are no elements. -
minBy<
R extends Comparable> (R selector(T)) → T? -
Available on KtIterable<
Returns the first element yielding the smallest value of the given function orT> , provided by the KtIterableExtensions extensionnull
if there are no elements. -
minOf<
R extends Comparable> (R selector(T)) → R -
Available on KtIterable<
Returns the smallest value among all values produced by selector function applied to each element in the array.T> , provided by the KtIterableExtensions extension -
minus(
KtIterable< T> elements) → KtList<T> -
Available on KtIterable<
Returns a list containing all elements of the original collection except the elements contained in the givenT> , provided by the KtIterableExtensions extensionelements
collection. -
minusElement(
T element) → KtList< T> -
Available on KtIterable<
Returns a list containing all elements of the original collection without the first occurrence of the givenT> , provided by the KtIterableExtensions extensionelement
. -
minWith(
Comparator< T> comparator) → T? -
Available on KtIterable<
Returns the first element having the smallest value according to the providedT> , provided by the KtIterableExtensions extensioncomparator
ornull
if there are no elements. -
none(
[bool predicate(T)?]) → bool -
Available on KtIterable<
ReturnsT> , provided by the KtIterableExtensions extensiontrue
if the collection has no elements or no elements match the givenpredicate
. -
partition(
bool predicate(T)) → KtPair< KtList< T> , KtList<T> > -
Available on KtIterable<
Splits the original collection into pair of lists, where first list contains elements for whichT> , provided by the KtIterableExtensions extensionpredicate
yieldedtrue
, while second list contains elements for whichpredicate
yieldedfalse
. -
plus(
KtIterable< T> elements) → KtList<T> -
Available on KtIterable<
Returns a list containing all elements of the original collection and then all elements of the givenT> , provided by the KtIterableExtensions extensionelements
collection. -
plusElement(
T element) → KtList< T> -
Available on KtIterable<
Returns a list containing all elements of the original collection and then the givenT> , provided by the KtIterableExtensions extensionelement
. -
reduce<
S> (S operation(S acc, T)) → S -
Available on KtIterable<
Accumulates value starting with the first element and applyingT> , provided by the KtIterableExtensions extensionoperation
from left to right to current accumulator value and each element. -
reduceIndexed<
S> (S operation(int index, S acc, T)) → S -
Available on KtIterable<
Accumulates value starting with the first element and applyingT> , provided by the KtIterableExtensions extensionoperation
from left to right to current accumulator value and each element with its index in the original collection. @paramoperation
function that takes the index of an element, current accumulator value and the element itself and calculates the next accumulator value. -
reduceIndexedOrNull<
S> (S operation(int index, S acc, T)) → S? -
Available on KtIterable<
Accumulates value starting with the first element and applyingT> , provided by the KtIterableExtensions extensionoperation
from left to right to current accumulator value and each element with its index in the original collection. -
reduceOrNull<
S> (S operation(S acc, T)) → S? -
Available on KtIterable<
Accumulates value starting with the first element and applyingT> , provided by the KtIterableExtensions extensionoperation
from left to right to current accumulator value and each element. -
reversed(
) → KtList< T> -
Available on KtIterable<
Returns a list with elements in reversed order.T> , provided by the KtIterableExtensions extension -
runningReduce<
S> (S operation(S acc, T)) → KtList< S> -
Available on KtIterable<
Returns a list containing successive accumulation values generated by applyingT> , provided by the KtIterableExtensions extensionoperation
from left to right to each element and current accumulator value that starts with the first element of this collection. -
runningReduceIndexed<
S> (S operation(int index, S acc, T)) → KtList< S> -
Available on KtIterable<
Returns a list containing successive accumulation values generated by applyingT> , provided by the KtIterableExtensions extensionoperation
from left to right to each element, its index in the original collection and current accumulator value that starts with the first element of this collection. -
shuffled(
[Random? random]) → KtList< T> -
Available on KtIterable<
Returns a new list with the elements of this list randomly shuffled.T> , provided by the KtIterableExtensions extension -
single(
[bool predicate(T)?]) → T -
Available on KtIterable<
Returns the single element matching the givenT> , provided by the KtIterableExtensions extensionpredicate
, or throws an exception if the list is empty or has more than one element. -
singleOrNull(
[bool predicate(T)?]) → T? -
Available on KtIterable<
Returns the single element matching the givenT> , provided by the KtIterableExtensions extensionpredicate
, ornull
if element was not found or more than one element was found. -
sorted(
) → KtList< T> -
Available on KtIterable<
Returns a list of all elements sorted according to their natural sort order.T> , provided by the KtIterableExtensions extension -
sortedBy<
R extends Comparable> (R selector(T)) → KtList< T> -
Available on KtIterable<
Returns a list of all elements sorted according to natural sort order of the value returned by specifiedT> , provided by the KtIterableExtensions extensionselector
function. -
sortedByDescending<
R extends Comparable> (R selector(T)) → KtList< T> -
Available on KtIterable<
Returns a list of all elements sorted descending according to natural sort order of the value returned by specifiedT> , provided by the KtIterableExtensions extensionselector
function. -
sortedDescending(
) → KtList< T> -
Available on KtIterable<
Returns a list of all elements sorted descending according to their natural sort order.T> , provided by the KtIterableExtensions extension -
sortedWith(
Comparator< T> comparator) → KtList<T> -
Available on KtIterable<
Returns a list of all elements sorted according to the specifiedT> , provided by the KtIterableExtensions extensioncomparator
. -
subtract(
KtIterable< T> other) → KtSet<T> -
Available on KtIterable<
Returns a set containing all elements that are contained by this collection and not contained by the specified collection.T> , provided by the KtIterableExtensions extension -
sumBy<
R extends num> (R selector(T)) → R -
Available on KtIterable<
Returns the sum of all values produced byT> , provided by the KtIterableExtensions extensionselector
function applied to each element in the collection. -
sumByDouble(
double selector(T)) → double -
Available on KtIterable<
Returns the sum of all values produced byT> , provided by the KtIterableExtensions extensionselector
function applied to each element in the collection. -
take(
int n) → KtList< T> -
Available on KtIterable<
Returns a list containing firstT> , provided by the KtIterableExtensions extensionn
elements. -
takeWhile(
bool predicate(T)) → KtList< T> -
Available on KtIterable<
Returns a list containing first elements satisfying the givenT> , provided by the KtIterableExtensions extensionpredicate
. -
toCollection<
C extends KtMutableCollection> (C destination) → C -
Available on KtIterable<
Appends all elements to the givenT> , provided by the KtIterableExtensions extensiondestination
collection. -
toHashSet(
) → KtMutableSet< T> -
Available on KtIterable<
Returns a HashSet of all elements.T> , provided by the KtIterableExtensions extension -
toList(
) → KtList< T> -
Available on KtIterable<
Returns a KtList containing all elements.T> , provided by the KtIterableExtensions extension -
toMutableList(
) → KtMutableList< T> -
Available on KtIterable<
Returns a KtMutableList filled with all elements of this collection.T> , provided by the KtIterableExtensions extension -
toMutableSet(
) → KtMutableSet< T> -
Available on KtIterable<
Returns a mutable set containing all distinct elements from the given collection.T> , provided by the KtIterableExtensions extension -
toSet(
) → KtSet< T> -
Available on KtIterable<
Returns a KtSet of all elements.T> , provided by the KtIterableExtensions extension -
union(
KtIterable< T> other) → KtSet<T> -
Available on KtIterable<
Returns a set containing all distinct elements from both collections.T> , provided by the KtIterableExtensions extension -
windowed(
int size, {int step = 1, bool partialWindows = false}) → KtList< KtList< T> > -
Available on KtIterable<
Returns a list of snapshots of the window of the givenT> , provided by the KtIterableExtensions extensionsize
sliding along this collection with the givenstep
, where each snapshot is a list. -
windowedTransform<
R> (int size, R transform(KtList< T> ), {int step = 1, bool partialWindows = false}) → KtList<R> -
Available on KtIterable<
Returns a list of results of applying the givenT> , provided by the KtIterableExtensions extensiontransform
function to an each list representing a view over the window of the givensize
sliding along this collection with the givenstep
. -
zip<
R> (KtIterable< R> other) → KtList<KtPair< T, R> > -
Available on KtIterable<
Returns a list of pairs built from the elements ofT> , provided by the KtIterableExtensions extensionthis
collection andother
collection with the same index. The returned list has length of the shortest collection. -
zipTransform<
R, V> (KtIterable< R> other, V transform(T a, R b)) → KtList<V> -
Available on KtIterable<
Returns a list of values built from the elements ofT> , provided by the KtIterableExtensions extensionthis
collection and theother
collection with the same index using the providedtransform
function applied to each pair of elements. The returned list has length of the shortest collection. -
zipWithNext(
) → KtList< KtPair< T, T> > -
Available on KtIterable<
Returns a list of pairs of each two adjacent elements in this collection.T> , provided by the KtIterableExtensions extension -
zipWithNextTransform<
R> (R transform(T a, T b)) → KtList< R> -
Available on KtIterable<
Returns a list containing the results of applying the givenT> , provided by the KtIterableExtensions extensiontransform
function to an each pair of two adjacent elements in this collection.
Operators
-
operator +(
KtIterable< T> elements) → KtList<T> -
Available on KtIterable<
Returns a list containing all elements of the original collection and then all elements of the givenT> , provided by the KtIterableExtensions extensionelements
collection. -
operator -(
KtIterable< T> elements) → KtList<T> -
Available on KtIterable<
Returns a list containing all elements of the original collection except the elements contained in the givenT> , provided by the KtIterableExtensions extensionelements
collection.