public interface Indexer<T> extends Iterable<Map.Entry<T,Integer>>
0
.Counter
Modifier and Type | Method and Description |
---|---|
void |
clear()
Removes all of the item-index mappings.
|
boolean |
contains(T item)
Returns
true if the item has a corresponding index |
int |
find(T item)
Returns the index for the item or a negative value corresponding to the
index the object would have been assigned if it had been added.
|
int |
highestIndex()
Returns the highest index to which any element is mapped.
|
int |
index(T item)
Adds the item and creates an index for it, returning that index.
|
boolean |
indexAll(Collection<T> items)
Adds an index for each item in the collection if it did not already
exist, returning
true if at least one new index was added. |
Set<T> |
items()
Returns an unmodifiable view of the items currently mapped to indices
|
Iterator<Map.Entry<T,Integer>> |
iterator()
Returns an iterator over all the objects and their corresponding indices.
|
T |
lookup(int index)
Returns the element to which this index is mapped or
null if the
index has not been mapped |
Map<Integer,T> |
mapping()
Returns an unmodifiable view from each index to the object mapped to that
index.
|
int |
size()
Returns the number of items that are mapped to indices.
|
int index(T item)
boolean indexAll(Collection<T> items)
true
if at least one new index was added.void clear()
boolean contains(T item)
true
if the item has a corresponding indexint find(T item)
int highestIndex()
Iterator<Map.Entry<T,Integer>> iterator()
remove
.T lookup(int index)
null
if the
index has not been mappedMap<Integer,T> mapping()
int size()
Copyright © 2012. All Rights Reserved.