Top Description Methods
org.pcollections

public Interface PStack<E>

extends PSequence<E>
Known Direct Implementers
org.pcollections.ConsPStack
Imports
java.util.Collection

An immutable, persistent stack.
Author
harold

Method Summary

Modifier and TypeMethod and Description
public PStack<E>
minus(Object e)

Redeclares org.pcollections.PSequence.minus.

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

public PStack<E>
public PStack<E>
public PStack<E>
plus(E e)

Redeclares org.pcollections.PSequence.plus.

Returns a stack consisting of the elements of this with e prepended.

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

Redeclares org.pcollections.PSequence.plus.

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

Redeclares org.pcollections.PSequence.plusAll.

Returns a stack consisting of the elements of this with list prepended in reverse.

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

Redeclares org.pcollections.PSequence.plusAll.

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

Redeclares org.pcollections.PSequence.subList.

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

public PStack<E>

Returns:

subList(start,this.size())
subList
(int start)

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

Redeclares org.pcollections.PSequence.with.

Inherited from org.pcollections.PSequence:
addaddAllremoveset

Method Detail

minusback to summary
public PStack<E> minus(Object e)

Redeclares org.pcollections.PSequence.minus.

Doc from org.pcollections.PSequence.minus.

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

Returns:PStack<E>

Doc from org.pcollections.PCollection.minus.

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

minusback to summary
public PStack<E> minus(int i)

Redeclares org.pcollections.PSequence.minus.

Returns:PStack<E>

Doc from org.pcollections.PSequence.minus.

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

minusAllback to summary
public PStack<E> minusAll(Collection<?> list)

Redeclares org.pcollections.PSequence.minusAll.

Returns:PStack<E>

Doc from org.pcollections.PCollection.minusAll.

this with all elements of list completely removed

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

Redeclares org.pcollections.PSequence.plus.

Returns a stack consisting of the elements of this with e prepended.

Returns:PStack<E>

Doc from org.pcollections.PCollection.plus.

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

plusback to summary
public PStack<E> plus(int i, E e)

Redeclares org.pcollections.PSequence.plus.

Returns:PStack<E>

Doc from org.pcollections.PSequence.plus.

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

plusAllback to summary
public PStack<E> plusAll(Collection<? extends E> list)

Redeclares org.pcollections.PSequence.plusAll.

Returns a stack consisting of the elements of this with list prepended in reverse.

Returns:PStack<E>

Doc from org.pcollections.PCollection.plusAll.

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

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

Redeclares org.pcollections.PSequence.plusAll.

Returns:PStack<E>

Doc from org.pcollections.PSequence.plusAll.

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

subListback to summary
public PStack<E> subList(int start, int end)

Redeclares org.pcollections.PSequence.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:PStack<E>

a view of the specified range within this list

subListback to summary
public PStack<E> subList(int start)
Returns:PStack<E>

subList(start,this.size())

withback to summary
public PStack<E> with(int i, E e)

Redeclares org.pcollections.PSequence.with.

Returns:PStack<E>

Doc from org.pcollections.PSequence.with.

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