Package org.organicdesign.fp.collections
Interface ImList<E>
-
- All Superinterfaces:
BaseList<E>,Collection<E>,Iterable<E>,List<E>,Sized,Transformable<E>,UnmodCollection<E>,UnmodIterable<E>,UnmodList<E>,UnmodSortedCollection<E>,UnmodSortedIterable<E>
- All Known Implementing Classes:
PersistentVector,RrbTree.ImRrbt
public interface ImList<E> extends BaseList<E>
Immutable copy-on-write list
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.organicdesign.fp.collections.UnmodIterable
UnmodIterable.UnIterable
-
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 @NotNull ImList<E>append(E e)Returns a new BaseList with the additional item at the end.default @NotNull ImList<E>appendSome(@NotNull Fn0<? extends @NotNull Option<E>> supplier)If supplier returns Some, return a new BaseList with the additional item at the end.default @NotNull ImList<E>concat(@Nullable Iterable<? extends E> es)Efficiently adds items to the end of this ImList.@NotNull MutList<E>mutable()Returns a mutable list (builder)@NotNull ImList<E>replace(int idx, E e)Replace the item at the given index.default @NotNull ImList<E>reverse()Returns a reversed copy of this list.-
Methods inherited from interface java.util.Collection
parallelStream, stream, toArray
-
Methods inherited from interface org.organicdesign.fp.xform.Transformable
any, toImList, toImMap, toImRrbt, toImSet, toImSortedMap, toImSortedSet, toMutList, toMutMap, toMutRrbt, toMutSet, toMutSortedMap, toMutSortedSet
-
Methods inherited from interface org.organicdesign.fp.collections.UnmodIterable
drop, dropWhile, filter, flatMap, fold, foldUntil, map, precat, take, takeWhile, whereNonNull
-
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
@NotNull @NotNull ImList<E> append(E e)
Returns a new BaseList with the additional item at the end.
-
appendSome
@Contract(pure=true) @NotNull default @NotNull ImList<E> appendSome(@NotNull @NotNull Fn0<? extends @NotNull Option<E>> supplier)
If supplier returns Some, return a new BaseList with the additional item at the end. If None, just return this BaseList unmodified.- Specified by:
appendSomein interfaceBaseList<E>- Parameters:
supplier- returnOption.Someto append,Nonefor a no-op.
-
concat
@Contract(pure=true) @NotNull default @NotNull ImList<E> concat(@Nullable @Nullable 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
@Contract(pure=true) @NotNull @NotNull ImList<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.
-
-