improve table sorting of utxos with the same hash

This commit is contained in:
Craig Raw 2022-04-26 16:21:13 +02:00
parent 6aa3bb2ff3
commit 37a8a0a7f9

View file

@ -35,7 +35,12 @@ public class UtxosTreeTable extends CoinTreeTable {
outputCol.setComparator((o1, o2) -> { outputCol.setComparator((o1, o2) -> {
UtxoEntry entry1 = (UtxoEntry)o1; UtxoEntry entry1 = (UtxoEntry)o1;
UtxoEntry entry2 = (UtxoEntry)o2; UtxoEntry entry2 = (UtxoEntry)o2;
return entry1.getDescription().compareTo(entry2.getDescription()); int hashCompare = entry1.getHashIndex().getHash().toString().compareTo(entry2.getHashIndex().getHash().toString());
if(hashCompare != 0) {
return hashCompare;
}
return (int)(entry1.getHashIndex().getIndex() - entry2.getHashIndex().getIndex());
}); });
getColumns().add(outputCol); getColumns().add(outputCol);