Package org.ldaptive.pool
Class Queue<T>
java.lang.Object
org.ldaptive.pool.Queue<T>
- Type Parameters:
T- type of object in the queue
- All Implemented Interfaces:
Iterable<T>
Provides a wrapper around a
Deque to support LIFO and FIFO operations.-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidAdds an object to the queue based on the queue type.booleanReturns whether t is in the queue.element()Retrieves, but does not remove, the first element in the queue.booleanisEmpty()Returns whether or not the queue is empty.iterator()remove()Removes the first element in the queue.booleanRemoves the supplied element from the queue.intsize()Returns the number of elements in the queue.toString()Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface java.lang.Iterable
forEach, spliterator
-
Field Details
-
queueType
How will objects be inserted into the queue. -
queue
Underlying queue.
-
-
Constructor Details
-
Queue
Creates a new queue.- Parameters:
type- how will objects be inserted into the queue
-
-
Method Details
-
add
Adds an object to the queue based on the queue type. SeeDeque.addFirst(Object)andDeque.addLast(Object).- Parameters:
t- to add
-
remove
Removes the first element in the queue. SeeDeque.removeFirst().- Returns:
- first element in the queue
-
remove
Removes the supplied element from the queue. SeeDeque.remove(Object).- Parameters:
t- to remove- Returns:
- whether t was removed
-
element
Retrieves, but does not remove, the first element in the queue. SeeDeque.getFirst().- Returns:
- first element in the queue
-
contains
Returns whether t is in the queue. SeeDeque.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. SeeCollection.isEmpty()}.- Returns:
- whether the queue is empty
-
size
public int size()Returns the number of elements in the queue. SeeDeque.size().- Returns:
- number of elements in the queue
-
iterator
-
toString
-