This week's book giveaway is in the OO, Patterns, UML and Refactoring forum.
We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line!
See this thread for details.
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes binarySearch() : Help Needed Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "binarySearch() : Help Needed" Watch "binarySearch() : Help Needed" New topic
Author

binarySearch() : Help Needed

Sandeep Vaid
Ranch Hand

Joined: Feb 27, 2006
Posts: 392
At page 557 :

If the collection/array you want to search was sorted using a Comparator, it must be searched using the same Comparator, which is passed as the second argument to the binarySearch() method. Remember that Comparators cannot be used when searching arrays of primitives.

Is comparator 2nd or 3rd argument to binarySearch() ?
Allan Jacobs
Greenhorn

Joined: Aug 28, 2006
Posts: 15
Third argument.

Simple API questions are answerable using the Javadoc for the Java API at
http://java.sun.com/j2se/1.5.0/docs/api/. The signature for the binarySearch
that takes a comparator is:

static <T> int binarySearch(T[] a, T key, Comparator<? super T> c)
 
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com
 
subject: binarySearch() : Help Needed
 
It's not a secret anymore!