T - The type of the list items.public class SequencedItemList<T extends SequencedItemList.Element>
extends java.lang.Object
| Modifier and Type | Class and Description |
|---|---|
static interface |
SequencedItemList.Element
Defines an Element that can be added to a SequencedItemList.
|
| Constructor and Description |
|---|
SequencedItemList()
Creates a new instance of the TruncateableList class.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
add(T item)
Adds a new item at the end of the list, but only if the given item has a Sequence Number higher than the last
element in the list.
|
void |
clear()
Clears the list.
|
T |
getLast()
Gets the last element in the list, if any.
|
java.util.Iterator<T> |
read(long afterSequenceNumber,
int count)
Reads a number of items starting with the first one that has a Sequence Number higher than the given one.
|
int |
truncate(long upToSequenceNumber)
Truncates items from the beginning of the list up to, and including, the element with the given Sequence Number.
|
public SequencedItemList()
public boolean add(T item)
item - The item to append.public int truncate(long upToSequenceNumber)
upToSequenceNumber - The Sequence Number to truncate up to.public void clear()
public T getLast()
public java.util.Iterator<T> read(long afterSequenceNumber, int count)
afterSequenceNumber - The sequence to search from.count - The maximum number of items to read.