Package org.wso2.carbon.queuing
Interface CarbonQueue<T>
- Type Parameters:
T- the type of objects stored in this queue.
public interface CarbonQueue<T>
represents a generic queue that can be used by the carbon platform.
-
Method Summary
Modifier and TypeMethodDescriptionvoidclear()Method to clear this queue.get(int index) Method to retrieve the element at the given index of this queue.intThis method returns the index of the given element on this queue.booleanisEmpty()Method to test whether this queue is empty.peek()Retrieves, but does not remove, the head of this queue.peek(int count) Retrieves, but does not remove, the given number of items from the top, which also includes the head of this queue.pop()Retrieves and removes, the head of this queue.pop(int count) Retrieves and removes, the given number of items from the top, which also includes the head of this queue.voidAdds the given elements onto the queue.voidAdds the given element onto the queue.intsize()Method to obtain the size of this queue.
-
Method Details
-
peek
Retrieves, but does not remove, the head of this queue.- Returns:
- the head of this queue.
- Throws:
QueueEmptyException- when this queue is empty.
-
peek
Retrieves, but does not remove, the given number of items from the top, which also includes the head of this queue.- Parameters:
count- the number of items to return.- Returns:
- the given number of items from the top, which also includes the head of this queue
- Throws:
QueueEmptyException- when this queue is empty.
-
pop
Retrieves and removes, the head of this queue.- Returns:
- the head of this queue.
- Throws:
QueueEmptyException- when this queue is empty.
-
pop
Retrieves and removes, the given number of items from the top, which also includes the head of this queue.- Parameters:
count- the number of items to return.- Returns:
- the given number of items from the top, which also includes the head of this queue.
- Throws:
QueueEmptyException- when this queue is empty.
-
push
Adds the given element onto the queue.- Parameters:
element- the element to add.
-
push
Adds the given elements onto the queue.- Parameters:
elements- the elements to add.
-
size
int size()Method to obtain the size of this queue.- Returns:
- the size of this queue.
-
isEmpty
boolean isEmpty()Method to test whether this queue is empty.- Returns:
- true if the queue is empty or false if not.
-
clear
void clear()Method to clear this queue. -
indexOf
This method returns the index of the given element on this queue.- Parameters:
element- the element.- Returns:
- the index of the given element.
- Throws:
QueueEmptyException- when this queue is empty.
-
get
Method to retrieve the element at the given index of this queue.- Parameters:
index- the index of the element.- Returns:
- the element.
-