Top Description Methods
org.pcollections

public Interface PSequence<E>

extends PCollection<E>, List<E>
Known Direct Subinterfaces
org.pcollections.PStack, org.pcollections.PVector
Imports
java.util.Collection, .List

An immutable, persistent indexed collection.
Author
harold

Method Summary

Modifier and TypeMethod and Description
public void
add(int
index at which the specified element is to be inserted
index
,
E
element to be inserted
element
)

Redeclares java.util.List.add.

Deprecated

Inserts the specified element at the specified position in this list (optional operation).

public boolean
addAll(int
index at which to insert the first element from the specified collection
index
,
Collection<? extends E>
collection containing elements to be added to this list
c
)

Redeclares java.util.List.addAll.

Deprecated

Inserts all of the elements in the specified collection into this list at the specified position (optional operation).

public PSequence<E>
minus(Object e)

Redeclares org.pcollections.PCollection.minus.

Returns a sequence consisting of the elements of this without the first occurrence of e.

public PSequence<E>

Returns:

a sequence consisting of the elements of this with the element at index i removed.
minus
(int i)

public PSequence<E>
public PSequence<E>
public PSequence<E>

Returns:

a sequence consisting of the elements of this with e inserted at index i.
plus
(int i, E e)

public PSequence<E>
public PSequence<E>

Returns:

a sequence consisting of the elements of this with list inserted at index i.
plusAll
(int i, Collection<? extends E> list)

public E
remove(int
the index of the element to be removed
index
)

Redeclares java.util.List.remove.

Deprecated

Removes the element at the specified position in this list (optional operation).

public E
set(int
index of the element to replace
index
,
E
element to be stored at the specified position
element
)

Redeclares java.util.List.set.

Deprecated

Replaces the element at the specified position in this list with the specified element (optional operation).

public PSequence<E>
subList(int
low endpoint (inclusive) of the subList
start
,
int
high endpoint (exclusive) of the subList
end
)

Redeclares java.util.List.subList.

Returns a view of the portion of this list between the specified fromIndex, inclusive, and toIndex, exclusive.

public PSequence<E>

Returns:

a sequence consisting of the elements of this with e replacing the element at index i.
with
(int i, E e)

Inherited from java.util.List:
addaddAlladdFirstaddLastclearcontainscontainsAllcopyOfequalsgetgetFirstgetLasthashCodeindexOfisEmptyiteratorlastIndexOflistIteratorlistIteratorofofofofofofofofofofofofremoveremoveAllremoveFirstremoveLastreplaceAllretainAllreversedsizesortspliteratortoArraytoArray
Inherited from org.pcollections.PCollection:
addaddAllclearremoveremoveAllretainAll

Method Detail

addback to summary
public void add(int index, E element)

Redeclares java.util.List.add.

Doc from java.util.List.add.

Deprecated

Inserts the specified element at the specified position in this list (optional operation). Shifts the element currently at that position (if any) and any subsequent elements to the right (adds one to their indices).

Parameters
index:int

index at which the specified element is to be inserted

element:E

element to be inserted

Annotations
@Deprecated
addAllback to summary
public boolean addAll(int index, Collection<? extends E> c)

Redeclares java.util.List.addAll.

Doc from java.util.List.addAll.

Deprecated

Inserts all of the elements in the specified collection into this list at the specified position (optional operation). Shifts the element currently at that position (if any) and any subsequent elements to the right (increases their indices). The new elements will appear in this list in the order that they are returned by the specified collection's iterator. The behavior of this operation is undefined if the specified collection is modified while the operation is in progress. (Note that this will occur if the specified collection is this list, and it's nonempty.)

Parameters
index:int

index at which to insert the first element from the specified collection

c:Collection<? extends E>

collection containing elements to be added to this list

Returns:boolean

true if this list changed as a result of the call

Annotations
@Deprecated
minusback to summary
public PSequence<E> minus(Object e)

Redeclares org.pcollections.PCollection.minus.

Returns a sequence consisting of the elements of this without the first occurrence of e.

Returns:PSequence<E>

Doc from org.pcollections.PCollection.minus.

this with a single instance of e removed, if e is in this

minusback to summary
public PSequence<E> minus(int i)
Returns:PSequence<E>

a sequence consisting of the elements of this with the element at index i removed.

Exceptions
IndexOutOfBoundsException:
if i<0 || i>=this.size()
minusAllback to summary
public PSequence<E> minusAll(Collection<?> list)

Redeclares org.pcollections.PCollection.minusAll.

Returns:PSequence<E>

Doc from org.pcollections.PCollection.minusAll.

this with all elements of list completely removed

plusback to summary
public PSequence<E> plus(E e)

Redeclares org.pcollections.PCollection.plus.

Returns:PSequence<E>

Doc from org.pcollections.PCollection.plus.

a collection which contains e and all of the elements of this

plusback to summary
public PSequence<E> plus(int i, E e)
Returns:PSequence<E>

a sequence consisting of the elements of this with e inserted at index i.

Exceptions
IndexOutOfBoundsException:
if i<0 || i>this.size()
plusAllback to summary
public PSequence<E> plusAll(Collection<? extends E> list)

Redeclares org.pcollections.PCollection.plusAll.

Returns:PSequence<E>

Doc from org.pcollections.PCollection.plusAll.

a collection which contains all of the elements of list and this

plusAllback to summary
public PSequence<E> plusAll(int i, Collection<? extends E> list)
Returns:PSequence<E>

a sequence consisting of the elements of this with list inserted at index i.

Exceptions
IndexOutOfBoundsException:
if i<0 || i>this.size()
removeback to summary
public E remove(int index)

Redeclares java.util.List.remove.

Doc from java.util.List.remove.

Deprecated

Removes the element at the specified position in this list (optional operation). Shifts any subsequent elements to the left (subtracts one from their indices). Returns the element that was removed from the list.

Parameters
index:int

the index of the element to be removed

Returns:E

the element previously at the specified position

Annotations
@Deprecated
setback to summary
public E set(int index, E element)

Redeclares java.util.List.set.

Doc from java.util.List.set.

Deprecated

Replaces the element at the specified position in this list with the specified element (optional operation).

Parameters
index:int

index of the element to replace

element:E

element to be stored at the specified position

Returns:E

the element previously at the specified position

Annotations
@Deprecated
subListback to summary
public PSequence<E> subList(int start, int end)

Redeclares java.util.List.subList.

Doc from java.util.List.subList.

Returns a view of the portion of this list between the specified fromIndex, inclusive, and toIndex, exclusive. (If fromIndex and toIndex are equal, the returned list is empty.) The returned list is backed by this list, so non-structural changes in the returned list are reflected in this list, and vice-versa. The returned list supports all of the optional list operations supported by this list.

This method eliminates the need for explicit range operations (of the sort that commonly exist for arrays). Any operation that expects a list can be used as a range operation by passing a subList view instead of a whole list. For example, the following idiom removes a range of elements from a list:

list.subList(from, to).clear();
Similar idioms may be constructed for indexOf and lastIndexOf, and all of the algorithms in the Collections class can be applied to a subList.

The semantics of the list returned by this method become undefined if the backing list (i.e., this list) is structurally modified in any way other than via the returned list. (Structural modifications are those that change the size of this list, or otherwise perturb it in such a fashion that iterations in progress may yield incorrect results.)

Parameters
start:int

low endpoint (inclusive) of the subList

end:int

high endpoint (exclusive) of the subList

Returns:PSequence<E>

a view of the specified range within this list

withback to summary
public PSequence<E> with(int i, E e)
Returns:PSequence<E>

a sequence consisting of the elements of this with e replacing the element at index i.

Exceptions
IndexOutOfBoundsException:
if i<0 || i>=this.size()