public class DelayedList<E>
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
protected java.util.List<java.util.List<E>> |
elements |
Constructor and Description |
---|
DelayedList() |
Modifier and Type | Method and Description |
---|---|
void |
add(int delay,
E element)
Adds an element that will by returned by
advance() after it has been called delay times. |
java.util.List<E> |
advance()
Advances this list by one, effectively decrementing the delays of every element by one and returning all
elements that have a delay of 0.
|
void |
clear()
Removes *all* elements from this list.
|
static <E> DelayedList<E> |
createConcurrent() |
java.util.List<java.util.List<E>> |
getAllElements() |
int |
getMaxDelay() |
protected final java.util.List<java.util.List<E>> elements
public static <E> DelayedList<E> createConcurrent()
public int getMaxDelay()
public java.util.List<E> advance()
public void add(int delay, E element)
advance()
after it has been called delay times.delay
- The number of times that advance needs to be called for the *next* advance to return this element.
Negative numbers default up to 0.public java.util.List<java.util.List<E>> getAllElements()
public void clear()