public class Indexer extends Object
Constructor and Description |
---|
Indexer() |
Modifier and Type | Method and Description |
---|---|
static <T> com.google.common.collect.BiMap<T,Integer> |
create(Collection<T> collection)
Returns a
BiMap mapping each element of the collection to its
index as encountered while iterating over the collection. |
static <T> com.google.common.collect.BiMap<T,Integer> |
create(Collection<T> collection,
int start)
Returns a
BiMap mapping each element of the collection to its
index as encountered while iterating over the collection. |
public static <T> com.google.common.collect.BiMap<T,Integer> create(Collection<T> collection)
BiMap
mapping each element of the collection to its
index as encountered while iterating over the collection. The purpose
of the index operation is to supply an O(1) replacement operation for the
O(n) indexOf(element)
method of a List
T
- the type of the collection elementscollection
- the collection whose indices are to be generatedpublic static <T> com.google.common.collect.BiMap<T,Integer> create(Collection<T> collection, int start)
BiMap
mapping each element of the collection to its
index as encountered while iterating over the collection. The purpose
of the index operation is to supply an O(1) replacement operation for the
O(n) indexOf(element)
method of a List
T
- the type of the collection elementscollection
- the collection whose indices are to be generatedstart
- start indexCopyright © 2015. All rights reserved.