V - The type of the IndexEntries.public interface SortedIndex<V extends SortedIndex.IndexEntry>
Notes:
| Modifier and Type | Interface and Description |
|---|---|
static interface |
SortedIndex.IndexEntry
Defines a generic entry into an Index.
|
| Modifier and Type | Method and Description |
|---|---|
void |
clear()
Clears the contents of the Index.
|
void |
forEach(java.util.function.Consumer<V> consumer)
Iterates through each item in the Index, in natural order, and calls the given consumer on all of them.
|
V |
get(long key)
Gets an item with the given key.
|
V |
getCeiling(long key)
Gets the smallest item whose key is greater than or equal to the given key.
|
V |
getFirst()
Gets the smallest item in the index.
|
V |
getFloor(long key)
Gets the largest item whose key is smaller than or equal to the given key.
|
V |
getLast()
Gets the largest item in the index.
|
V |
put(V item)
Inserts the given item into the Index.
|
V |
remove(long key)
Removes any item with the given key from the Index.
|
int |
size()
Gets a value indicating the number of items in the Index.
|
void clear()
V put(V item)
item - The item to insert.V remove(long key)
key - The key of the item to remove.int size()
V get(long key)
key - The key to search by.V getCeiling(long key)
key - the Key to search by.V getFloor(long key)
key - the Key to search by.V getFirst()
V getLast()
void forEach(java.util.function.Consumer<V> consumer)
consumer - The consumer to invoke.java.util.ConcurrentModificationException - If the Index is modified while this method is executing.