IterableUtils class

Helper class for operations on iterables

Constructors

IterableUtils()

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited

Static Methods

chunk<T>(List<T> list, int size) List<List<T>>
Splits the given list into sublist of the given size.
containsAll(Iterable iterable1, Iterable iterable2) bool
Returns true if all elements of iterable2 are also contained in iterable1.
containsAny(Iterable iterable1, Iterable iterable2) bool
Returns true if at least one element is in both collections.
emptyIfNull(Iterable? collection) Iterable
Returns an immutable empty collection if the argument is null, or the argument itself otherwise.
emptyIterable() Iterable
Returns the immutable _emptyIterable.
intersection(Iterable iterable1, Iterable iterable2) Iterable
Returns a Iterable containing the intersection of the given Iterable.
isNotNullOrEmpty(Iterable? iterable) bool
Checks if the given Iterable iterable is not null or empty
isNullOrEmpty(Iterable? iterable) bool
Checks if the given Iterable iterable is null or empty
permutate(List data) List<List>
Creates a permutation if the given list data by swapping each items to get the amount of data.length!.
randomItem<T>(Iterable<T> iterable) → T
Returns a random element in iterable. Throws RangeError if iterable is null or empty.
size(dynamic iterable) int
Gets the size of the Iterator, Map or specified.
sizeIsEmpty(dynamic iterable) bool
Gets the size of the Iterator, Map or specified.
subtract(Iterable iterable1, Iterable iterable2) Iterable
Returns a new Iterable containing a minus a subset of b. Only the elements of b that satisfy the predicate condition, p are subtracted from a.
swap(List input, int a, int b) → void
Swaps the given index a and b in the given input
union<E>(Iterable<E> iterable1, Iterable<E> iterable2) Iterable<E>
Returns an Iterable containing the union of the given Iterable. The cardinality of each element in the returned Iterable will be equal to the maximum of the cardinality of that element in the two given Iterable.
zip<T>(Iterable<T> a, Iterable<T> b) Iterable<T>
Make an Iterable that aggregates elements from each of the iterables.