mirror of
https://github.com/konsoletyper/teavm.git
synced 2024-11-27 01:30:35 +08:00
Merge pull request #140 from mpoindexter/master-fix-collections-binary-search
Fix the order comparison is applied in for binarySearch to match the …
This commit is contained in:
commit
b9f43b981f
@ -259,10 +259,10 @@ public class TCollections extends TObject {
|
||||
while (true) {
|
||||
int i = (l + u) / 2;
|
||||
T e = list.get(i);
|
||||
int cmp = c.compare(key, e);
|
||||
int cmp = c.compare(e, key);
|
||||
if (cmp == 0) {
|
||||
return i;
|
||||
} else if (cmp < 0) {
|
||||
} else if (cmp > 0) {
|
||||
u = i - 1;
|
||||
if (u < l) {
|
||||
return -i - 1;
|
||||
|
Loading…
Reference in New Issue
Block a user