T
- public class SortedArray<T> extends Object
A utility class to hold a unique instance of comparable objects like ServerInfo or Script in an array. Each object is assigned a new index when it is not found which the created object is expected to hold.
This enables creation of Array based data structures which can be looked up by the object index instead of a map.
Modifier and Type | Class and Description |
---|---|
static interface |
SortedArray.IndexUpdater |
Constructor and Description |
---|
SortedArray() |
Modifier and Type | Method and Description |
---|---|
T |
findItem(T item,
Comparator<T> c,
SortedArray.IndexUpdater indexUpdater)
Finds an item or creates it.
|
public T findItem(T item, Comparator<T> c, SortedArray.IndexUpdater indexUpdater)
item
- item to findc
- Comparator to use to search sorted arrayindexUpdater
- Index Updater to use to update new index in case item was not foundCopyright © 2013- Suresh Mahalingam. All Rights Reserved.