Class TreePVector<E>
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.
- Author:
- harold
- See Also:
-
Field Summary
Fields inherited from class AbstractList
modCount -
Method Summary
Modifier and TypeMethodDescriptionstatic <E> TreePVector<E> empty()static <E> TreePVector<E> from(Collection<? extends E> list) get(int index) iterator()/ OVERRIDDEN METHODS FROM AbstractList ////minus(int i) Returns a sequence consisting of the elements of this without the first occurrence of e.minusAll(Collection<?> list) / IMPLEMENTED METHODS OF PVector ////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()/ REQUIRED METHODS FROM AbstractList ////subList(int start, int end) Methods inherited from class AbstractUnmodifiableList
add, add, addAll, addAll, clear, remove, remove, removeAll, removeIf, replaceAll, retainAll, set, sortMethods inherited from class AbstractList
equals, hashCode, indexOf, lastIndexOf, listIterator, listIterator, removeRangeMethods inherited from class AbstractCollection
contains, containsAll, isEmpty, toArray, toArray, toStringMethods inherited from interface Collection
parallelStream, removeIf, stream, toArrayMethods inherited from interface 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()/ REQUIRED METHODS FROM AbstractList ////- Specified by:
sizein interfaceCollection<E>- Specified by:
sizein interfaceList<E>- Specified by:
sizein classAbstractCollection<E>
-
get
-
iterator
-
subList
-
plus
-
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
-