ListCorextension<E> extension

on

Properties

allChoices List<List<E>>
Gets all the possible choices from this.
read-only
hasDuplicates bool
Returns true if this has any duplicates present.
read-only
isSingle bool
Returns true if there is only one element in this.
read-only

Methods

addWithin(E addition) → void
Returns a new list where the provided addition is added in between every 2 elements in this.
allIndicesOf(E element) List<int>
Finds all the indices of the element in this.
allIndicesWhere(bool f(E element)) List<int>
Finds all the indices of the elements in this that satisfy the provided function.
allPermutations() Iterable<List<E>>
Returns all the permutations of this.
containsInOrder(List<E> subset) bool
Returns true if the provided elements are found in the list, in the specified order.
count(E element) int
Counts the number of times the value is present in the iterable.
countWhere(bool fn(E element)) int
Counts the number of elements in the iterable that satisfy the fn.
distanceTo(List<E> permutation) int
Finds the distance between this and its permutation.
endsWith(List<E> values) bool
Returns true if this ends with the elements in the provided list values. The equality of the values is evaluated directly.
firstDifferenceTo(List<E> permutation) int
Finds the index of the first difference between this and a permutation provided.
hasSameElementsAs(List<E> list) bool
Returns true if the elements within this and the other list are the same. The order in which they appear is irrelevant.
hasSameLengthAs<L>(Iterable<L> iterable) bool
Returns true if the length of this is the same as the length of the provided iterable.
mapWithIndex<S>(S f(E element, int i)) Iterable<S>
Returns a new lazy iterable with elements that are created by calling f on each element of this List in iteration order.
otherPermutations() Iterable<List<E>>
Returns all the permutations of this, excluding this one.
partitionInOrder(bool function(E previousValue, E thisValue, int i, List<E> thisPartition)) List<List<E>>
Given a function that we can run 2 consecutive elements of this, partitions the list by the result.
permute(List<int> indices) → void
Permutes the elements in the list given a list of indices, in that order.
replaceElementsByReorganisation(int startIndex, int endIndex, List<int> changeArray) → void
Replace elements within this by reorganising the elements.
startsWith(List<E> values) bool
Returns true if this starts with the elements in the provided list values. The equality of the values is evaluated directly.
swap(int i, int j) → void
Given two indices in this, swaps elements at those indices within this list.
updateAll(E f(E element)) → void
Updates the value of all the elements in this using the function.
withOrder(List<int> newOrder) List<E>
Returns a version of this where the elements in the list appear in the provided newOrder.