mirror of
https://github.com/processing/processing4.git
synced 2026-02-03 21:59:20 +01:00
fixing sort() methods so they are actually, you know, accurate... also ironing out Table bits
This commit is contained in:
@@ -86,6 +86,16 @@ public class IntDict {
|
||||
}
|
||||
|
||||
|
||||
public IntDict(String[] keys, int[] values) {
|
||||
if (keys.length != values.length) {
|
||||
throw new IllegalArgumentException("key and value arrays must be the same length");
|
||||
}
|
||||
this.keys = keys;
|
||||
this.values = values;
|
||||
count = keys.length;
|
||||
}
|
||||
|
||||
|
||||
public int size() {
|
||||
return count;
|
||||
}
|
||||
@@ -375,7 +385,7 @@ public class IntDict {
|
||||
diff = keys[a].compareToIgnoreCase(keys[b]);
|
||||
}
|
||||
}
|
||||
return reverse ? diff : -diff;
|
||||
return reverse ? -diff : diff;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -414,7 +424,7 @@ public class IntDict {
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append(getClass().getName() + " size= " + size() + " { ");
|
||||
sb.append(getClass().getSimpleName() + " size=" + size() + " { ");
|
||||
for (int i = 0; i < size(); i++) {
|
||||
if (i != 0) {
|
||||
sb.append(", ");
|
||||
|
||||
Reference in New Issue
Block a user