java.lang.Object
me.sbasalaev.collection.Collection<T>
me.sbasalaev.collection.List<T>
me.sbasalaev.collection.MutableList<T>
- All Implemented Interfaces:
Cloneable,Iterable<T>,MutableCollection<T>,Traversable<T>
List that can be mutated.
-
Method Summary
Modifier and TypeMethodDescriptionbooleanAdds new element to the end of this list.booleanaddAll(Collection<? extends T> elements) Adds all elements from given collection to the end of this list.static <T> MutableList<T> empty()New mutable list that is initially empty.voidindexedTransform(BiFunction<Integer, T, T> transformation) Transforms elements of this list using given transformation.abstract voidInserts element at the specified index of the list.voidinsertAll(int insertIndex, Collection<? extends T> elements) Inserts elements at the specified position of the list.static <T> MutableList<T> of(Collection<? extends T> elements) New mutable list that initially contains given elements.static <T> MutableList<T> of(T... elements) New mutable list that initially contains given elements.abstract TremoveAt(int elementIndex) Removes element at given index.abstract voidremoveRange(int from, int to) Removes all elements in given range of this list.abstract TAssigns new element to the given index.abstract voidsortBy(Comparator<? super T> comparing) Sorts this list using given comparator.voidtransform(UnaryOperator<T> transformation) Transforms elements of this list using given transformation.Methods inherited from class me.sbasalaev.collection.List
binarySearch, clone, concatenated, equals, filtered, findIndex, findIndex, findLastIndex, first, forEachIndexed, forEachPair, from, fromJava, get, hashCode, indexed, iterator, last, lastIndex, map, mapped, pairs, repeat, reversed, spliterator, take, toJava, zipMethods inherited from class me.sbasalaev.collection.Collection
count, fillArray, isEmpty, nonEmpty, size, stream, toArray, toArray, toList, toSet, toStringMethods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface java.lang.Iterable
forEach, iterator, spliteratorMethods inherited from interface me.sbasalaev.collection.MutableCollection
clear, remove, removeAllMatching, retainAllMatching
-
Method Details
-
empty
New mutable list that is initially empty. -
of
New mutable list that initially contains given elements. -
of
New mutable list that initially contains given elements. -
set
Assigns new element to the given index.- Throws:
IndexOutOfBoundsException- ifindex < 0orindex >= size()
-
insert
Inserts element at the specified index of the list.- Throws:
IndexOutOfBoundsException- ifindex < 0orindex > size()
-
insertAll
Inserts elements at the specified position of the list. Elements are inserted in the order returned by collection iterator. -
add
Adds new element to the end of this list.- Specified by:
addin interfaceMutableCollection<T>- Returns:
truebecause list always changes after this operation.
-
addAll
Adds all elements from given collection to the end of this list.- Specified by:
addAllin interfaceMutableCollection<T>- Returns:
trueif the supplied collection is non-empty.
-
removeAt
Removes element at given index. -
removeRange
public abstract void removeRange(int from, int to) Removes all elements in given range of this list. -
sortBy
Sorts this list using given comparator. -
transform
Transforms elements of this list using given transformation.- Since:
- 3.1
-
indexedTransform
Transforms elements of this list using given transformation.- Since:
- 3.1
-