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

    Modifier and Type Method Description
    boolean has()
    Determines whether there are elements remaining in the queue.
    List<T> poll()
    Polls this Queue and returns ≤ maxPoll elements.

    Methods inherited from class java.lang.Object

    equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • GroupQueue

      public GroupQueue​(Collection<T> l, int maxPoll)
      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

      public List<T> 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.