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
FieldsModifier and TypeFieldDescriptionprivate static final TreePVector
<Object> private final IntTreePMap
<E> private static final long
Fields inherited from class java.util.AbstractList
modCount
-
Constructor Summary
Constructors -
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) int
size()
subList
(int start, int end) Methods inherited from class org.pcollections.AbstractUnmodifiableList
add, add, addAll, addAll, clear, remove, remove, removeAll, removeIf, replaceAll, retainAll, set, sort
Methods inherited from class java.util.AbstractList
equals, hashCode, indexOf, lastIndexOf, listIterator, listIterator, removeRange
Methods inherited from class java.util.AbstractCollection
contains, containsAll, isEmpty, toArray, toArray, toString
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.util.Collection
parallelStream, removeIf, stream, toArray
Methods 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
-
Field Details
-
serialVersionUID
private static final long serialVersionUID- See Also:
-
EMPTY
-
map
-
-
Constructor Details
-
TreePVector
-
-
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:
size
in interfaceCollection<E>
- Specified by:
size
in interfaceList<E>
- Specified by:
size
in classAbstractCollection<E>
-
get
-
iterator
-
subList
-
plus
Description copied from interface:PVector
Returns a vector consisting of the elements of this with e appended. -
plus
-
minus
Description copied from interface:PSequence
Returns a sequence consisting of the elements of this without the first occurrence of e. -
minus
-
plusAll
Description copied from interface:PVector
Returns a vector consisting of the elements of this with list appended. -
minusAll
-
plusAll
-
with
-