i believe when they said "must be searched using the same Comparator" they mean that would be the comparator best built to exploit the sorted order.
i don't see any other logical reason.
Adi Sharma wrote: Hi guys
I was reading :
"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"
I was wondering as to why do we need to pass the same comparator to the binarySearch() method???
Thanks a lot
Aditya Sharma