HeartIterableE<E> extension

Extension methods that maintain types.

on

Methods

backwards() List<E>
Reverses and returns a List.
drop(int n) List<E>
Removes first n elements.
dropWhile(bool dropFunction(E sub)) List<E>
Removes elements until criteria not met.
elemIndices(E element) List<int>
Finds each index where element occurs.
filter(bool filterFunction(E element)) List<E>
Removes elements that don't meet criteria.
group() List<List<E>>
Items are in the same sublist if they are equal to the one next to it.
groupBy(bool groupFunction(dynamic a, dynamic b)) List<List<E>>
Items are in the same sublist if they meet the criteria that compares consecutive elements.
Returns the first element.
inits() List<List<E>>
Returns a List of Lists by adding one element at a time, starting from the beginning.
interleave(Iterable<E> it) List<E>
Combines elements by taking turns. First element in original iterable is the first element of the result.
intersect(Iterable<E> input) List<E>
Keeps all values that are also in input String, using deepEquals.
intersperse(E element) List<E>
Inserts an element in between each element.
nub([Iterable<E>? it]) List<E>
Removes duplicates by using deepEquals.
replaceAll(E from, [dynamic to]) List<E>
Similar to .replaceAll for Strings.
replaceFirst(E from, [dynamic to]) List<E>
Similar to .replaceFirst for Strings.
riffleIn() List<E>
Splits into two and uses interleave to combine, second half first.
riffleOut() List<E>
Splits into two and uses interleave to combine.
shuffled({bool cryptographicallySecure = false}) List<E>
Returns a shuffled List.
splitAt(int n) List<List<E>>
Splits into two Lists after first n elements.
subtract(Iterable<E> sublist) List<E>
Removes elements one at a time, using deepEquals.
subtractAll(Iterable<E> sublist) List<E>
Removes all elements if they are in sublist.
tail() List<E>?
Removes the first element, keeps the "tail".
tails() List<List<E>>
Returns a List of Lists by removing one element at a time, starting from the beginning.
toStringList() List<String>
Converts all elements to Strings.
union(Iterable<E> l) List<E>
Adds elements from input that aren't in original value.

Operators

operator *(int n) List<E>
Repeat elements n times.