Originally posted by Jan Groth:
hi jesper,
i was already checking the javadoc, but to be honest i did not fully understand the documentation of the return value of binarySearch:
are we sure that a returned value >0 implies "found" ? i'm not :-)
If you have read that then do it again and carefully read last line.
index of the search key, if it is contained in the list; otherwise, (-(insertion point) - 1). The insertion point is defined as the point at which the key would be inserted into the list: the index of the first element greater than the key, or list.size(), if all elements in the list are less than the specified key. Note that this guarantees that the return value will be >= 0 if and only if the key is found.
.
Hoep your doubts would be clear now.
Please let us know if there are any issues.
[ September 29, 2006: Message edited by: Ankur Sharma ]
[ September 29, 2006: Message edited by: Ankur Sharma ]