it.unimi.dsi.fastutil
Class PriorityQueues.EmptyPriorityQueue

java.lang.Object
  extended by it.unimi.dsi.fastutil.AbstractPriorityQueue
      extended by it.unimi.dsi.fastutil.PriorityQueues.EmptyPriorityQueue
All Implemented Interfaces:
PriorityQueue
Enclosing class:
PriorityQueues

public static class PriorityQueues.EmptyPriorityQueue
extends AbstractPriorityQueue

An immutable class representing the empty priority queue.

This class may be useful to implement your own in case you subclass PriorityQueue.


Constructor Summary
protected PriorityQueues.EmptyPriorityQueue()
           
 
Method Summary
 void changed()
          Notifies the queue that the first element has changed (optional operation).
 void clear()
          Removes all elements from this queue.
 Comparator<?> comparator()
          Returns the comparator associated with this queue, or null if it uses its elements' natural ordering.
 Object dequeue()
          Dequeues the first element from the queue.
 void enqueue(Object o)
          Enqueues a new element.
 Object first()
          Returns the first element of the queue.
 boolean isEmpty()
          Checks whether the queue is empty.
 Object last()
          Returns the last element of the queue, that is, the element the would be dequeued last (optional operation).
 int size()
          Returns the number of elements in this queue.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PriorityQueues.EmptyPriorityQueue

protected PriorityQueues.EmptyPriorityQueue()
Method Detail

enqueue

public void enqueue(Object o)
Description copied from interface: PriorityQueue
Enqueues a new element.

Parameters:
o - the element to enqueue..

dequeue

public Object dequeue()
Description copied from interface: PriorityQueue
Dequeues the first element from the queue.

Returns:
the dequeued element.

isEmpty

public boolean isEmpty()
Description copied from interface: PriorityQueue
Checks whether the queue is empty.

Specified by:
isEmpty in interface PriorityQueue
Overrides:
isEmpty in class AbstractPriorityQueue
Returns:
true if the queue is empty.

size

public int size()
Description copied from interface: PriorityQueue
Returns the number of elements in this queue.

Returns:
the number of elements in this queue.

clear

public void clear()
Description copied from interface: PriorityQueue
Removes all elements from this queue.


first

public Object first()
Description copied from interface: PriorityQueue
Returns the first element of the queue.

Returns:
the first element.

last

public Object last()
Description copied from interface: PriorityQueue
Returns the last element of the queue, that is, the element the would be dequeued last (optional operation).

Specified by:
last in interface PriorityQueue
Overrides:
last in class AbstractPriorityQueue
Returns:
the last element.

changed

public void changed()
Description copied from interface: PriorityQueue
Notifies the queue that the first element has changed (optional operation).

Specified by:
changed in interface PriorityQueue
Overrides:
changed in class AbstractPriorityQueue

comparator

public Comparator<?> comparator()
Description copied from interface: PriorityQueue
Returns the comparator associated with this queue, or null if it uses its elements' natural ordering.

Returns:
the comparator associated with this sorted set, or null if it uses its elements' natural ordering.


Copyright © 2011. All Rights Reserved.