Browse Source

avoid casting to int when comparing longs

bwt
Craig Raw 4 years ago
parent
commit
3a4d385560
  1. 2
      drongo
  2. 2
      src/main/java/com/sparrowwallet/sparrow/control/UtxosChart.java
  3. 2
      src/main/java/com/sparrowwallet/sparrow/wallet/HashIndexEntry.java
  4. 6
      src/main/java/com/sparrowwallet/sparrow/wallet/TransactionEntry.java
  5. 10
      ~/.sparrow-peak/config

2
drongo

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

2
src/main/java/com/sparrowwallet/sparrow/control/UtxosChart.java

@ -39,7 +39,7 @@ public class UtxosChart extends BarChart<String, Number> {
public void update(WalletUtxosEntry walletUtxosEntry) {
List<Data<String, Number>> utxoDataList = walletUtxosEntry.getChildren().stream()
.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());
totalUtxos = utxoDataList.size();

2
src/main/java/com/sparrowwallet/sparrow/wallet/HashIndexEntry.java

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

6
src/main/java/com/sparrowwallet/sparrow/wallet/TransactionEntry.java

@ -97,15 +97,15 @@ public class TransactionEntry extends Entry implements Comparable<TransactionEnt
TransactionHashIndexEntry entry1 = (TransactionHashIndexEntry) o1;
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());
}
if (!entry1.getType().equals(entry2.getType())) {
if(!entry1.getType().equals(entry2.getType())) {
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;

10
~/.sparrow-peak/config

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