Top Fields Constructors Methods
org.pcollections

public Class AmortizedPQueue<E>

extends AbstractUnmodifiableQueue<E>
implements PQueue<E>, Serializable
Class Inheritance
All Implemented Interfaces
java.io.Serializable, org.pcollections.PQueue, java.util.Queue, java.util.Collection, java.lang.Iterable, org.pcollections.PCollection
Imports
java.io.Serializable, java.util.Collection, .Iterator, .NoSuchElementException

Author
mtklein

Field Summary

Modifier and TypeField and Description
private final PStack<E>
private static final AmortizedPQueue<Object>
private final PStack<E>
private static final long

Constructor Summary

AccessConstructor and Description
private
private
private
AmortizedPQueue(PStack<E> front, PStack<E> back)

Method Summary

Modifier and TypeMethod and Description
public static <E> AmortizedPQueue<E>
public Iterator<E>
iterator()

Implements abstract java.util.AbstractCollection.iterator.

Implements java.util.Collection.iterator.

Returns an iterator over the elements in this collection.

public AmortizedPQueue<E>
public PCollection<E>
public PCollection<E>
public E
peek()

Implements java.util.Queue.peek.

Retrieves, but does not remove, the head of this queue, or returns null if this queue is empty.

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

Implements org.pcollections.PQueue.plusAll.

public int
size()

Implements abstract java.util.AbstractCollection.size.

Implements java.util.Collection.size.

Returns the number of elements in this collection.

Inherited from org.pcollections.AbstractUnmodifiableQueue:
addaddAllclearofferpollremoveremoveremoveAllremoveIfretainAll

Field Detail

backback to summary
private final PStack<E> back
EMPTYback to summary
private static final AmortizedPQueue<Object> EMPTY
frontback to summary
private final PStack<E> front
serialVersionUIDback to summary
private static final long serialVersionUID

Constructor Detail

AmortizedPQueueback to summary
private AmortizedPQueue()
AmortizedPQueueback to summary
private AmortizedPQueue(AmortizedPQueue<E> queue, E e)
AmortizedPQueueback to summary
private AmortizedPQueue(PStack<E> front, PStack<E> back)

Method Detail

emptyback to summary
public static <E> AmortizedPQueue<E> empty()
Annotations
@SuppressWarnings:unchecked
iteratorback to summary
public Iterator<E> iterator()

Implements abstract java.util.AbstractCollection.iterator.

Implements java.util.Collection.iterator.

Doc from java.util.Collection.iterator.

Returns an iterator over the elements in this collection. There are no guarantees concerning the order in which the elements are returned (unless this collection is an instance of some class that provides a guarantee).

Returns:Iterator<E>

an Iterator over the elements in this collection

Annotations
@Override
minusback to summary
public AmortizedPQueue<E> minus()

Implements org.pcollections.PQueue.minus.

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

Implements org.pcollections.PQueue.minus.

Returns:PCollection<E>

Doc from org.pcollections.PCollection.minus.

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

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

Implements org.pcollections.PQueue.minusAll.

Returns:PCollection<E>

Doc from org.pcollections.PCollection.minusAll.

this with all elements of list completely removed

peekback to summary
public E peek()

Implements java.util.Queue.peek.

Doc from java.util.Queue.peek.

Retrieves, but does not remove, the head of this queue, or returns null if this queue is empty.

Returns:E

the head of this queue, or null if this queue is empty

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

Implements org.pcollections.PQueue.plus.

Returns:AmortizedPQueue<E>

Doc from org.pcollections.PCollection.plus.

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

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

Implements org.pcollections.PQueue.plusAll.

Returns:AmortizedPQueue<E>

Doc from org.pcollections.PCollection.plusAll.

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

sizeback to summary
public int size()

Implements abstract java.util.AbstractCollection.size.

Implements java.util.Collection.size.

Doc from java.util.Collection.size.

Returns the number of elements in this collection. If this collection contains more than Integer.MAX_VALUE elements, returns Integer.MAX_VALUE.

Returns:int

the number of elements in this collection

Annotations
@Override