ListExtensions<E> extension
Extension methods for any List.
- on
-
- List<
E>
- List<
Properties
- random → E
-
Returns a random element from the list.
no setter
Methods
-
addIfNotNull(
E? value) → bool -
Adds
value
to the end of this list only if it's not null. -
copyWith(
E element) → List< E> -
Copy current list with adding
element
at the end of new list. -
copyWithAll(
List< E> elements) → List<E> -
Copy current list with adding all
elements
at the end of new list. -
copyWithInsertAll(
int index, List< E> elements) → List<E> -
Copy current list with adding all
elements
at the position of new list. -
copyWithReplace(
E element, E replacement) → List< E> -
Copy current list, replacing all
element
occurrences withreplacement
. -
copyWithReplaceWhere(
TestPredicate< E> test, E replacement) → List<E> -
Copy current list, replacing elements of list that
satisfy
test
predicate withreplacement
. -
replace(
E element, E replacement) → bool -
Replaces all
element
occurrences withreplacement
. -
replaceWhere(
TestPredicate< E> test, E replacement) → bool -
Replaces all elements of list that satisfy
test
predicate withreplacement
. -
sortBy(
Comparable getVal(E e)) → void - Sorts the list in ascending order of the object's field value.
-
sortByDescending(
Comparable getVal(E e)) → void - Sorts the list in descending order of the object's field value.