Package org.fastily.jwiki.util
Class GroupQueue<T>
java.lang.Object
org.fastily.jwiki.util.GroupQueue<T>
- Type Parameters:
T
- The type of Object contained in the queue.
public class GroupQueue<T> extends Object
A simple read-only Queue that allows multiple items to be polled at once.
- Author:
- Fastily
-
Constructor Summary
Constructors Constructor Description GroupQueue(Collection<T> l, int maxPoll)
Constructor, creates a new GroupQueue. -
Method Summary
-
Constructor Details
-
GroupQueue
Constructor, creates a new GroupQueue.- Parameters:
l
- The backing ArrayList to use. This will not be modified.maxPoll
- The maximum number of elements to poll at once.
-
-
Method Details
-
poll
Polls this Queue and returns ≤maxPoll
elements.- Returns:
- An ArrayList with the first
maxPoll
elements if possible. Returns the empty list if there is nothing left.
-
has
public boolean has()Determines whether there are elements remaining in the queue.- Returns:
- True if there are elements left in the queue.
-