Arrays.binarySearch -- help

From: Victor Chapman (victor.chapman_at_sympatico.ca)
Date: 11/26/03


Date: Wed, 26 Nov 2003 12:40:18 -0500

I think that I should be able to do the following:

I have an object called teams

teams is made up of
name
city
coach
averagePoints

I have built a Comparator that uses name
I sort all of the occurrences of the object using the comparator so that it
is in ascending (alphabetical) order based on name.

Now I want to binary search the teams object to find a hit using name as the
key.

The following doesn't work!
Arrays.binarySearch(teams, inTeam, compName);

I think that I need something like the following:

Arrays.binarySearch(teams.getName, inTeam compName);
This doesn't work either.

So if it is possible to do what I am trying to achieve, I would like to know
how to do it. Thanks.

-- 
Regards,
Victor Chapman