T
- Node type, required to extend FastList.Node so that the FastList
can keep working data for each Node without using mapping or extra
data structures.class FastList<T extends FastList.Node> extends Object implements Iterable<T>
Modifier and Type | Class and Description |
---|---|
private class |
FastList.FastListIteratorImpl |
(package private) static class |
FastList.Node
The type parameter for the FastList, T, must extend this type, and all
nodes added to the list are of type T.
|
Modifier and Type | Field and Description |
---|---|
private Queue<T> |
baseQueue
The underlying queue.
|
private java.util.concurrent.atomic.AtomicLong |
nextIndex
The next index, a modified form of timestamp.
|
Constructor and Description |
---|
FastList() |
Modifier and Type | Method and Description |
---|---|
void |
add(T node)
Add a node to the tail of the list.
|
Iterator<T> |
iterator() |
(package private) Iterator<T> |
rawIterator()
Iterator that includes all physically present items,
regardless of when they were added or whether they have
been logically removed.
|
void |
reap()
Scan the list, physically removing nodes that have already been logically
removed.
|
boolean |
remove(T node)
Remove the node.
|
private final java.util.concurrent.atomic.AtomicLong nextIndex
private final Queue<T extends FastList.Node> baseQueue
public void add(T node)
node
- Each node can only be added once, regardless of removal.IllegalArgumentException
- The node has been added to a list previously.public boolean remove(T node)
node
- IllegalArgumentException
- The node has not been added to this FastList.public void reap()
public Iterator<T> iterator()
iterator
in interface Iterable<T extends FastList.Node>
Iterator<T> rawIterator()
Copyright 2007-2013, multiple authors.
Licensed under the Apache License, Version 2.0, see the NOTICE file for attributions.