KtcList<E> extension

on

Properties

lastIndex int
Returns the index of the last item in the List or -1 if the List is empty.
no setter

Methods

binarySearchBy<K extends Comparable?>({required K? selector(E element), K? key, int? fromIndex, int? toIndex}) int
Searches this List or its range for an element having the key returned by the specified selector function equal to the provided key value using the binary search algorithm. The List is expected to be sorted into ascending order according to the Comparable natural ordering of keys of its elements. otherwise the result is undefined.
binarySearchWithComparator({required E element, required Comparator<E> comparator, int? fromIndex, int? toIndex}) int
Searches this List or its range for the provided element using the binary search algorithm. The List is expected to be sorted into ascending order according to the specified comparator, otherwise the result is undefined.
binarySearchWithComparison({required int comparison(E element), int? fromIndex, int? toIndex}) int
Searches this List or its range for an element for which the given comparison function returns zero using the binary search algorithm.
containsAll(Iterable<E> other) bool
Checks if all elements in the specified collection are contained in this collection.
dropLast(int count) List<E>
Returns a List containing all elements except last count elements.
dropLastWhile(bool test(E element)) List<E>
Returns a List containing all elements except first elements that satisfy the given test.
foldRight<R>(R initialValue, R combine(R previousValue, E element)) → R
Accumulates value starting with initialValue and applying combine function from right to left to each element and current accumulator value.
foldRightIndexed<R>(R initialValue, R combine(int index, R previousValue, E element)) → R
Accumulates value starting with initialValue and applying combine function from right to left to each element with its index in the original List and current accumulator value.
random([Random? random]) → E
Returns a random element from this collection using the specified source of randomness.
randomOrNull([Random? random]) → E?
Returns a random element from this collection using the specified source of randomness, or null if this collection is empty.
shuffled([Random? random]) List<E>
Returns a new List with the elements of this List randomly shuffled using the specified random instance as the source of randomness.
slice(Iterable<int> indices) List<E>
Returns a List containing elements at specified indices.

Operators

operator &(Iterable<E> other) List<E>
Returns a List containing all elements that are contained by both this collection and the specified collection.
operator +(Iterable<E> other) List<E>
Returns an List containing all elements of the original collection and then all elements of the other collection.
operator -(Iterable<E> other) List<E>
Returns an List containing all elements of the original collection except the elements contained in the other collection.
operator <<(int count) List<E>
Returns an List that has been removed by the number of count from the beginning.
operator >>(int count) List<E>
Returns an List that has been removed by the number of count from the end.
operator ^(Iterable<E> other) List<E>
Returns a List containing all elements from both collections without intersect.
operator |(Iterable<E> other) List<E>
Returns a List containing all distinct elements from both collections.