On Tue, Apr 15, 2008 at 6:45 PM, Matthew Toseland
<toad at amphibian.dyndns.org> wrote:
> On Tuesday 15 April 2008 02:20, j16sdiz at freenetproject.org wrote:
>  > Author: j16sdiz
>  > Date: 2008-04-15 01:20:23 +0000 (Tue, 15 Apr 2008)
>  > New Revision: 19340
>  >
>  > Modified:
>  >    trunk/freenet/src/freenet/support/Fields.java
>  >    trunk/freenet/src/freenet/support/SortedLongSet.java
>  > Log:
>  > fix and use Fields.binarySearch
>
>  Was it broken? I agree your version is shorter and more elegant, but was 
> there
>  a problem with the logic before? (For purposes of changelogs)?
>

Consider the most common usage:
  long[] array = ....;
  int x = binarySearch( array, 0, array.length - 1);

If array.length is 0, the old implementation throw index out of bound exception.

- java.util.Arrays.binarySearch() allow this
- this add no observable overhead
.... so, why not?

Regards,
Daniel Cheng

Reply via email to