TLongLinkedList binarySearch problem?

Issue #47 new
RobPodolski
created an issue

Try...

TLongList nums = new TLongLinkedList(); nums.add(1L); nums.add(2L); nums.add(3L); nums.add(4L); nums.add(6L); nums.add(7L); nums.add(8L); nums.add(9L); nums.add(10L); nums.sort(); System.out.println(nums.binarySearch(4L));

Gives -4 not 3 as one might expect.

Replace TLongLinkedList with TLongArrayList and you indeed get 3. Can understand that the first one is a linked list of course and the behaviour is kind of to be expected as 5L is missing from nums. Still, this is confusing.