avoid casting to int when comparing longs

This commit is contained in:
Craig Raw 2020-10-27 11:11:35 +02:00
parent d3881f76b9
commit 3a4d385560
5 changed files with 16 additions and 6 deletions

2
drongo

@ -1 +1 @@
Subproject commit 401d3b8bfbffb8396a4d76737b4d335389b60051 Subproject commit 67c76c3b28158e38dbf6a5a3eb49f4a03b01b7b1

View file

@ -39,7 +39,7 @@ public class UtxosChart extends BarChart<String, Number> {
public void update(WalletUtxosEntry walletUtxosEntry) { public void update(WalletUtxosEntry walletUtxosEntry) {
List<Data<String, Number>> utxoDataList = walletUtxosEntry.getChildren().stream() List<Data<String, Number>> utxoDataList = walletUtxosEntry.getChildren().stream()
.map(entry -> new XYChart.Data<>(getCategoryName(entry), (Number)entry.getValue(), entry)) .map(entry -> new XYChart.Data<>(getCategoryName(entry), (Number)entry.getValue(), entry))
.sorted((o1, o2) -> (int) (o2.getYValue().longValue() - o1.getYValue().longValue())) .sorted((o1, o2) -> Long.compare(o2.getYValue().longValue(), o1.getYValue().longValue()))
.collect(Collectors.toList()); .collect(Collectors.toList());
totalUtxos = utxoDataList.size(); totalUtxos = utxoDataList.size();

View file

@ -101,6 +101,6 @@ public class HashIndexEntry extends Entry implements Comparable<HashIndexEntry>
return o.getHashIndex().getComparisonHeight() - getHashIndex().getComparisonHeight(); return o.getHashIndex().getComparisonHeight() - getHashIndex().getComparisonHeight();
} }
return (int)o.getHashIndex().getIndex() - (int)getHashIndex().getIndex(); return Long.compare(o.getHashIndex().getIndex(), (int)getHashIndex().getIndex());
} }
} }

View file

@ -97,15 +97,15 @@ public class TransactionEntry extends Entry implements Comparable<TransactionEnt
TransactionHashIndexEntry entry1 = (TransactionHashIndexEntry) o1; TransactionHashIndexEntry entry1 = (TransactionHashIndexEntry) o1;
TransactionHashIndexEntry entry2 = (TransactionHashIndexEntry) o2; TransactionHashIndexEntry entry2 = (TransactionHashIndexEntry) o2;
if (!entry1.getHashIndex().getHash().equals(entry2.getHashIndex().getHash())) { if(!entry1.getHashIndex().getHash().equals(entry2.getHashIndex().getHash())) {
return entry1.getHashIndex().getHash().compareTo(entry2.getHashIndex().getHash()); return entry1.getHashIndex().getHash().compareTo(entry2.getHashIndex().getHash());
} }
if (!entry1.getType().equals(entry2.getType())) { if(!entry1.getType().equals(entry2.getType())) {
return entry1.getType().ordinal() - entry2.getType().ordinal(); return entry1.getType().ordinal() - entry2.getType().ordinal();
} }
return (int) entry1.getHashIndex().getIndex() - (int) entry2.getHashIndex().getIndex(); return Long.compare(entry1.getHashIndex().getIndex(), entry2.getHashIndex().getIndex());
}); });
return childEntries; return childEntries;

10
~/.sparrow-peak/config Normal file
View file

@ -0,0 +1,10 @@
{
"mode": "OFFLINE",
"bitcoinUnit": "AUTO",
"groupByAddress": true,
"includeMempoolChange": true,
"notifyNewTransactions": true,
"checkNewVersions": true,
"theme": "LIGHT",
"useProxy": false
}