IterableExtensions<T> extension
Provides extended methods for T
arrays.
T
の配列用の拡張メソッドを提供します。
- on
-
- Iterable<
T>
- Iterable<
Properties
- firstOrNull → T?
-
Returns the first element.
no setter
- lastOrNull → T?
-
Returns the last element.
no setter
Methods
-
containsAll(
Iterable< Object?> elements) → bool -
Returns
true
if Iterable contains allelements
. -
containsAny(
Iterable< Object?> elements) → bool -
Returns
true
if Iterable contains any ofelements
. -
distinct(
[Object key(T element)?]) → List< T> - Deletes duplicate elements in an array.
-
equalsTo(
Iterable< T> others) → bool -
Returns
true
if the internals of Iterable andothers
are compared and match. -
expandAndRemoveEmpty<
TCast> (Iterable< TCast?> callback(T item)) → List<TCast> -
Each element of the list is converted to
TCast
data usingcallback
. -
firstWhereOrNull(
bool test(T item)) → T? -
Returns the first element for which the return value of
test
istrue
. -
insertEvery(
T value, int per) → Iterable< T> -
Inserts a
value
element for eachper
of Iterable. -
lastWhereOrNull(
bool test(T item)) → T? -
Returns the last element for which the return value of
test
istrue
. -
limit(
int start, int end) → List< T> -
Extract only the elements from
start
toend
of Iterable. -
limitEnd(
int end) → List< T> -
Extract only the elements to
end
of Iterable. -
limitStart(
int start) → List< T> -
Extract only the elements from
start
of Iterable. -
mapAndRemoveEmpty<
TCast> (TCast? callback(T item)) → List< TCast> -
Each element of the list is converted to
TCast
data usingcallback
. -
print(
) → void - print the entire contents of List.
-
setWhere<
K extends Object> (Iterable< T> others, {required bool test(T original, T other), required K? apply(T original, T other), K? orElse(T original)?}) → Iterable<K> -
If
others
is given to Iterable and the return value oftest
istrue
, the return value ofapply
is replaced with the corresponding value of Iterable. -
split(
int length) → Iterable< Iterable< T> > -
Iterable is divided into
length
elements each, creating a list of lists. -
splitWhere(
bool test(T a, T b)) → Iterable< Iterable< T> > -
Groups Iterable together with elements that have a return value of
true
fortest
and returns a list of each group. -
toMap<
K, V> (MapEntry< K, V> ? f(T item)) → Map<K, V> -
The callback given by
f
from Iterable will create a map ofK
andV
.