java.lang.Object
java.util.AbstractCollection<E>
java.util.AbstractList<E>
org.pcollections.AbstractUnmodifiableList<E>
org.pcollections.TreePVector<E>
- Type Parameters:
E-
- All Implemented Interfaces:
Serializable,Iterable<E>,Collection<E>,List<E>,PCollection<E>,PSequence<E>,PVector<E>
A persistent vector of elements.
This implementation is backed by an IntTreePMap and supports logarithmic-time querying, setting, insertion, and removal.
This implementation is thread-safe (assuming Java's AbstractList is thread-safe) although its iterators may not be.
Null values are supported.
- See Also:
-
Field Summary
Fields inherited from class java.util.AbstractList
modCount -
Method Summary
Modifier and TypeMethodDescriptionstatic <E> TreePVector<E>empty()static <E> TreePVector<E>from(Collection<? extends E> list) get(int index) iterator()minus(int i) Returns a sequence consisting of the elements of this without the first occurrence of e.minusAll(Collection<?> list) Returns a vector consisting of the elements of this with e appended.plusAll(int i, Collection<? extends E> list) plusAll(Collection<? extends E> list) Returns a vector consisting of the elements of this with list appended.static <E> TreePVector<E>singleton(E e) intsize()subList(int start, int end) Methods inherited from class org.pcollections.AbstractUnmodifiableList
add, add, addAll, addAll, clear, remove, remove, removeAll, removeIf, replaceAll, retainAll, set, sortMethods inherited from class java.util.AbstractList
equals, hashCode, indexOf, lastIndexOf, listIterator, listIterator, removeRangeMethods inherited from class java.util.AbstractCollection
contains, containsAll, isEmpty, toArray, toArray, toStringMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface java.util.Collection
parallelStream, removeIf, stream, toArrayMethods inherited from interface java.util.List
add, addAll, clear, contains, containsAll, equals, hashCode, indexOf, isEmpty, lastIndexOf, listIterator, listIterator, remove, removeAll, replaceAll, retainAll, sort, spliterator, toArray, toArray
-
Method Details
-
empty
- Type Parameters:
E-- Returns:
- an empty vector
-
singleton
- Type Parameters:
E-- Parameters:
e-- Returns:
- empty().plus(e)
-
from
- Type Parameters:
E-- Parameters:
list-- Returns:
- empty().plusAll(list)
-
size
public int size()- Specified by:
sizein interfaceCollection<E>- Specified by:
sizein interfaceList<E>- Specified by:
sizein classAbstractCollection<E>
-
get
-
iterator
-
subList
-
plus
Description copied from interface:PVectorReturns a vector consisting of the elements of this with e appended. -
plus
-
minus
Description copied from interface:PSequenceReturns a sequence consisting of the elements of this without the first occurrence of e. -
minus
-
plusAll
Description copied from interface:PVectorReturns a vector consisting of the elements of this with list appended. -
minusAll
-
plusAll
-
with
-