DHUCollectionsExtensions<T> extension

on

Properties

encodedJson String
no setter
halfLength int
no setter

Methods

all(Predicate<T>? predicate) bool
Returns true if all elements match the given predicate. Example: 5, 19, 2.all(isEven), isFalse) 6, 12, 2.all(isEven), isTrue)
any(Predicate<T> predicate) bool
Returns true if at least one element matches the given predicate.
concatWithMultipleList(List<Iterable<T>> iterables) List<T>
Return a list concatenates the output of the current list and multiple iterables
concatWithSingleList(Iterable<T> iterable) List<T>
Return a list concatenates the output of the current list and another iterable
containsAll(Iterable<T> collection) bool
Checks if all elements in the specified collection are contained in this collection.
count([Predicate<T>? predicate]) int
Return a number of the existing elements by a specific predicate example: final aboveTwenty = User(33, "chicko"), User(45, "ronit"), User(19, "amsalam"), .count((user) => user.age > 20); // 2
distinctBy(Predicate<T> predicate) List<T>
Returns a list containing only the elements from given collection having distinct keys.
drop(int n) List<T>
Returns a list containing all elements except first n elements.
filter(Predicate<T> test) List<T>
Returns a list containing only elements matching the given predicate.
filterNot(Predicate<T> test) List<T>
Returns a list containing all elements not matching the given predicate and will filter nulls as well.
find(Predicate<T> predicate) → T?
Returns the first element matching the given predicate, or null if element was not found.
firstHalf() List<T>
forEachIndexed(void action(T element, int index)) → void
Performs the given action on each element on iterable, providing sequential index with the element. item the element on the current iteration index the index of the current iteration
getRandom() → T
groupBy<T, K>(K key(T e)) Map<K, List<T>>
Groups the elements in values by the value returned by key.
intersect(Iterable<T> other) Set<T>
Returns a set containing all elements that are contained by both this set and the specified collection.
mapList<E>(E f(T e)) List<E>
orEmpty() Iterable<T>
Returns this Iterable if it's not null and the empty list otherwise.
secondHalf() List<T>
sortedDescending() List<T>
Returns a new list with all elements sorted according to descending natural sort order.
subtract(Iterable<T> other) → dynamic
Returns a set containing all elements that are contained by this collection and not contained by the specified collection. The returned set preserves the element iteration order of the original collection.
swap(int i, int j) List<T>
returns a list with two swapped items i first item j second item
takeOnly(int n) List<T>
Returns a list containing first n elements.
toMutableSet() Set<T>
Convert iterable to set
whereIndexed(IndexedPredicate<T> predicate) Iterable<T>
Will retrun new Iterable with all elements that satisfy the predicate predicate,