I\'m a bit lost on the way to make this happen the fastest. I have a large list of objects that have basic variable attributes (with getters / setters) and I need to do a se
Take a look at the binarySearch that takes a comparator:
public static int binarySearch(List list, T key, Comparator c)
So you would do something like:
class FooComparator
implements Comparator
{
public int compare(T a, T b)
{
return (a.getName().compareTo(b.getName());
}
}
int index = Collections.binarySearch(myList, "value", new FooComparator());
You will need to first sort the list of course (Collections.sort takes a Comaprator as well...).