Sorry Roger,  I should have done more test before agreed with you.

Te usage of ArrayList.BinarySearch isn't what I think the documentation
describes, for example:
array of [21, 43, 65] and y is 64 should result a positive 2 but it return
-3.  As this, we have to do the -(x + 1) every time.

and of course, the greater the array scope will have to determine
separately.  so I coded it this way:

<http://apache-pivot-users.399431.n3.nabble.com/file/n4022484/Screen_Shot_2013-03-06_at_10.32.11_AM.png>
 

In case, we want to keep using BinarySearch.  I also figure out a simpler
way of doing it:

rowIndex = -1;
for (int i = 0; i < rowBoundaries.getLength(); i++)
if (y < rowBoundaries.get(i).intValue())
  return rowIndex = i;

not sure in terms of performance, is this really so much poorer? but for
sure, it more clear and less problem.

Brendan



--
View this message in context: 
http://apache-pivot-users.399431.n3.nabble.com/IndexOutOfBoundException-in-TableView-when-Highlight-is-set-to-true-tp4022474p4022484.html
Sent from the Apache Pivot - Users mailing list archive at Nabble.com.

Reply via email to