OSDN Git Service

Don't rely on comparator returning -1
authorhneuer <hanno.neuer@gmail.com>
Mon, 30 Sep 2013 06:39:54 +0000 (08:39 +0200)
committerhneuer <hanno.neuer@gmail.com>
Mon, 30 Sep 2013 06:39:54 +0000 (08:39 +0200)
gdx/src/com/badlogic/gdx/utils/QuickSelect.java

index 00ac18e..460e877 100644 (file)
@@ -25,7 +25,7 @@ public class QuickSelect<T> {
                swap(right, pivot);
                int storage = left;
                for (int i = left; i < right; i++) {
-                       if (comp.compare(array[i], pivotValue) == -1) {
+                       if (comp.compare(array[i], pivotValue) < 0) {
                                swap(storage, i);
                                storage++;
                        }