org.ldaptive.pool
Class Queue<T>

java.lang.Object
  extended by org.ldaptive.pool.Queue<T>
Type Parameters:
T - type of object in the queue
All Implemented Interfaces:
Iterable<T>

public class Queue<T>
extends Object
implements Iterable<T>

Provides a wrapper around a Deque to support LIFO and FIFO operations.

Version:
$Revision: 2885 $ $Date: 2014-02-05 16:28:49 -0500 (Wed, 05 Feb 2014) $
Author:
Middleware Services

Constructor Summary
Queue(QueueType type)
          Creates a new queue.
 
Method Summary
 void add(T t)
          Adds an object to the queue based on the queue type.
 boolean contains(T t)
          Returns whether t is in the queue.
 T element()
          Retrieves, but does not remove, the first element in the queue.
 boolean isEmpty()
          Returns whether or not the queue is empty.
 Iterator<T> iterator()
          
 T remove()
          Removes the first element in the queue.
 boolean remove(T t)
          Removes the supplied element from the queue.
 int size()
          Returns the number of elements in the queue.
 String toString()
          
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Queue

public Queue(QueueType type)
Creates a new queue.

Parameters:
type - how will objects be inserted into the queue
Method Detail

add

public void add(T t)
Adds an object to the queue based on the queue type. See Deque.offerFirst(Object) and Deque.offerLast(Object).

Parameters:
t - to add

remove

public T remove()
Removes the first element in the queue. See Deque.removeFirst().

Returns:
first element in the queue

remove

public boolean remove(T t)
Removes the supplied element from the queue. See Deque.remove(Object).

Parameters:
t - to remove
Returns:
whether t was removed

element

public T element()
Retrieves, but does not remove, the first element in the queue. See Deque.getFirst().

Returns:
first element in the queue

contains

public boolean contains(T t)
Returns whether t is in the queue. See Deque.contains(Object).

Parameters:
t - that may be in the queue
Returns:
whether t is in the queue

isEmpty

public boolean isEmpty()
Returns whether or not the queue is empty. See Collection.isEmpty()}.

Returns:
whether the queue is empty

size

public int size()
Returns the number of elements in the queue. See Deque.size().

Returns:
number of elements in the queue

iterator

public Iterator<T> iterator()

Specified by:
iterator in interface Iterable<T>

toString

public String toString()

Overrides:
toString in class Object


Copyright © 2003-2015 Virginia Tech. All Rights Reserved.