org.pcollections

## Class TreePVector<E>

- java.lang.Object
- - java.util.AbstractCollection<E>
  - - java.util.AbstractList<E>
    - - org.pcollections.TreePVector<E>

Type Parameters:
  `E` -

All Implemented Interfaces:
  Iterable<E>, Collection<E>, List<E>, PCollection<E>, PSequence<E>, PVector<E>

    public class TreePVector<E>
    extends AbstractList<E>
    implements PVector<E>

A persistent vector of non-null 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.

### Field Summary

### Fields inherited from class java.util.AbstractList

`modCount`

### Method Summary

Methods
`static <E> TreePVector<E>` `empty()`
`static <E> TreePVector<E>` `from(Collection<? extends E> list)`
`E` `get(int index)`
`Iterator<E>` `iterator()`
`TreePVector<E>` `minus(int i)`
`TreePVector<E>` `minus(Object e)` Returns a sequence consisting of the elements of this without the first occurrence of e.
`TreePVector<E>` `minusAll(Collection<?> list)`
`TreePVector<E>` `plus(E e)` Returns a vector consisting of the elements of this with e appended.
`TreePVector<E>` `plus(int i, E e)`
`TreePVector<E>` `plusAll(Collection<? extends E> list)` Returns a vector consisting of the elements of this with list appended.
`TreePVector<E>` `plusAll(int i, Collection<? extends E> list)`
`static <E> TreePVector<E>` `singleton(E e)`
`int` `size()`
`TreePVector<E>` `subList(int start, int end)`
`PVector<E>` `with(int i, E e)`

### Methods inherited from class java.util.AbstractList

`add, add, addAll, clear, equals, hashCode, indexOf, lastIndexOf, listIterator, listIterator, remove, removeRange, set`

### Methods inherited from class java.util.AbstractCollection

`addAll, contains, containsAll, isEmpty, remove, removeAll, retainAll, toArray, toArray, toString`

### Methods inherited from class java.lang.Object

`clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

### Methods inherited from interface org.pcollections.PSequence

`add, addAll, remove, set`

### Methods inherited from interface org.pcollections.PCollection

`add, addAll, clear, remove, removeAll, retainAll`

### Methods inherited from interface java.util.List

`add, addAll, clear, contains, containsAll, equals, hashCode, indexOf, isEmpty, lastIndexOf, listIterator, listIterator, remove, removeAll, retainAll, toArray, toArray`

### Method Detail

#### empty

    public static <E> TreePVector<E> empty()

Type Parameters:
  `E` -
Returns:
  an empty vector

#### singleton

    public static <E> TreePVector<E> singleton(E e)

Type Parameters:
  `E` -
Parameters:
  `e` -
Returns:
  empty().plus(e)

#### from

    public static <E> TreePVector<E> from(Collection<? extends E> list)

Type Parameters:
  `E` -
Parameters:
  `list` -
Returns:
  empty().plusAll(list)

#### size

    public int size()

Specified by:
  `size` in interface `Collection<E>`
Specified by:
  `size` in interface `List<E>`
Specified by:
  `size` in class `AbstractCollection<E>`

#### get

    public E get(int index)

Specified by:
  `get` in interface `List<E>`
Specified by:
  `get` in class `AbstractList<E>`

#### iterator

    public Iterator<E> iterator()

Specified by:
  `iterator` in interface `Iterable<E>`
Specified by:
  `iterator` in interface `Collection<E>`
Specified by:
  `iterator` in interface `List<E>`
Overrides:
  `iterator` in class `AbstractList<E>`

#### subList

    public TreePVector<E> subList(int start,
                         int end)

Specified by:
  `subList` in interface `List<E>`
Specified by:
  `subList` in interface `PSequence<E>`
Specified by:
  `subList` in interface `PVector<E>`
Overrides:
  `subList` in class `AbstractList<E>`

#### plus

    public TreePVector<E> plus(E e)

Description copied from interface: `PVector`
Returns a vector consisting of the elements of this with e appended.

Specified by:
  `plus` in interface `PCollection<E>`
Specified by:
  `plus` in interface `PSequence<E>`
Specified by:
  `plus` in interface `PVector<E>`
Parameters:
  `e` - non-null
Returns:
  a collection which contains e and all of the elements of this

#### plus

    public TreePVector<E> plus(int i,
                      E e)

Specified by:
  `plus` in interface `PSequence<E>`
Specified by:
  `plus` in interface `PVector<E>`
  `e` - non-null
Returns:
  a sequence consisting of the elements of this with e inserted at index i.

#### minus

    public TreePVector<E> minus(Object e)

Description copied from interface: `PSequence`
Returns a sequence consisting of the elements of this without the first occurrence of e.

Specified by:
  `minus` in interface `PCollection<E>`
Specified by:
  `minus` in interface `PSequence<E>`
Specified by:
  `minus` in interface `PVector<E>`
Returns:
  this with a single instance of e removed, if e is in this

#### minus

    public TreePVector<E> minus(int i)

Specified by:
  `minus` in interface `PSequence<E>`
Specified by:
  `minus` in interface `PVector<E>`
Returns:
  a sequence consisting of the elements of this with the element at index i removed.

#### plusAll

    public TreePVector<E> plusAll(Collection<? extends E> list)

Description copied from interface: `PVector`
Returns a vector consisting of the elements of this with list appended.

Specified by:
  `plusAll` in interface `PCollection<E>`
Specified by:
  `plusAll` in interface `PSequence<E>`
Specified by:
  `plusAll` in interface `PVector<E>`
Parameters:
  `list` - contains no null elements
Returns:
  a collection which contains all of the elements of list and this

#### minusAll

    public TreePVector<E> minusAll(Collection<?> list)

Specified by:
  `minusAll` in interface `PCollection<E>`
Specified by:
  `minusAll` in interface `PSequence<E>`
Specified by:
  `minusAll` in interface `PVector<E>`
Returns:
  this with all elements of list completely removed

#### plusAll

    public TreePVector<E> plusAll(int i,
                         Collection<? extends E> list)

Specified by:
  `plusAll` in interface `PSequence<E>`
Specified by:
  `plusAll` in interface `PVector<E>`
Returns:
  a sequence consisting of the elements of this with list inserted at index i.

#### with

    public PVector<E> with(int i,
                  E e)

Specified by:
  `with` in interface `PSequence<E>`
Specified by:
  `with` in interface `PVector<E>`
Returns:
  a sequence consisting of the elements of this with e replacing the element at index i.

2015 Copyright © Apache Software Foundation

Follow @ApacheIgnite

Ignite Fabric | : ver. 1.0.0-RC3
Release Date | : March 24 2015