edu.harvard.seas.iis.util.collections
Class ReverseIndex
java.lang.Object
edu.harvard.seas.iis.util.collections.ReverseIndex
public class ReverseIndex
- extends Object
- Author:
- kgajos
A reverse index for an array of objects -- given an array it builds a reverse
mapping that lets you lookup the object's position within the array.
At the moment it is assumed that objects are unique within each array.
The objects have to implement hashCode() and equals()
Method Summary |
int |
getLocation(Object o)
Returns the location of the given object in the original array; |
ReverseIndex
public ReverseIndex(Object[] in)
getLocation
public int getLocation(Object o)
- Returns the location of the given object in the original array;
- Parameters:
o
- object to be looked up
- Returns:
- its position in the original array or -1 if not found