T
- the token typepublic class ListComparator<T> extends AbstractIndexComparator<T,T>
indexMap
Constructor and Description |
---|
ListComparator(java.util.List<T> list)
Constructs the comparator from the given list of objects by mapping each
object in the list to its index in the list.
|
ListComparator(java.util.Map<T,java.lang.Integer> indexMap)
Constructs the comparator from the given index map of each object in a
list to its index in the list.
|
Modifier and Type | Method and Description |
---|---|
int |
compare(T arg0,
T arg1) |
createIndexMap, getIndexMap
public ListComparator(java.util.List<T> list)
list
- the list of objects used to construct this comparator. May not
be null
.java.lang.NullPointerException
- if the given list is null
public ListComparator(java.util.Map<T,java.lang.Integer> indexMap)
indexMap
- map of each object in a list to its index in the list. May not
be null
.java.lang.NullPointerException
- if the specified map is null
Copyright © 2011 Massachusetts Institute of Technology. All Rights Reserved.