Package org.organicdesign.fp.collections
Interface MutableList<E>
-
- All Superinterfaces:
BaseList<E>,java.util.Collection<E>,java.lang.Iterable<E>,java.util.List<E>,Sized,Transformable<E>,UnmodCollection<E>,UnmodIterable<E>,UnmodList<E>,UnmodSortedCollection<E>,UnmodSortedIterable<E>
- All Known Implementing Classes:
PersistentVector.MutableVector,RrbTree.MutableRrbt
public interface MutableList<E> extends BaseList<E>
A mutate-in-place interface using the same copy-on-write methods asBaseListandImListso that you can treat mutable and immutable lists the same. You could think of this as a builder for an ImList, or just a stand-alone MutableList that behaves similarly (extendsTransformable). Being mutable, this is inherently NOT thread-safe.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.organicdesign.fp.collections.UnmodList
UnmodList.AbstractUnmodList<E>
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description MutableList<E>append(E val)Adds one item to the end of the ImList.default MutableList<E>concat(java.lang.Iterable<? extends E> es)Efficiently adds items to the end of this ImList.ImList<E>immutable()Returns a immutable version of this mutable list.MutableList<E>replace(int idx, E e)Replace the item at the given index.default MutableList<E>reverse()Returns a reversed copy of this list.-
Methods inherited from interface org.organicdesign.fp.xform.Transformable
toImList, toImMap, toImRrbt, toImSet, toImSortedMap, toImSortedSet, toMutableList, toMutableMap, toMutableRrbt, toMutableSet, toMutableSortedMap, toMutableSortedSet
-
Methods inherited from interface org.organicdesign.fp.collections.UnmodIterable
drop, dropWhile, filter, flatMap, fold, foldUntil, map, precat, take, takeWhile
-
Methods inherited from interface org.organicdesign.fp.collections.UnmodList
add, add, addAll, addAll, clear, contains, containsAll, indexOf, isEmpty, iterator, lastIndexOf, listIterator, listIterator, remove, remove, removeAll, removeIf, replaceAll, retainAll, set, sort, subList, toArray, toArray
-
-
-
-
Method Detail
-
append
MutableList<E> append(E val)
Adds one item to the end of the ImList.
-
concat
default MutableList<E> concat(java.lang.Iterable<? extends E> es)
Efficiently adds items to the end of this ImList.- Specified by:
concatin interfaceBaseList<E>- Specified by:
concatin interfaceTransformable<E>- Specified by:
concatin interfaceUnmodIterable<E>- Parameters:
es- the values to insert- Returns:
- a new ImList with the additional items at the end.
-
replace
MutableList<E> replace(int idx, E e)
Replace the item at the given index. Note: i.replace(i.size(), o) used to be equivalent to i.concat(o), but it probably won't be for the RRB tree implementation, so this will change too.
-
reverse
default MutableList<E> reverse()
Returns a reversed copy of this list.
-
-