mirror of
https://github.com/Qortal/altcoinj.git
synced 2025-01-31 07:12:17 +00:00
Use the new Transaction.SORT_TX_BY_UPDATE_TIME comparator and refresh comments.
This commit is contained in:
parent
2b80e4cfd1
commit
302bb3e21d
@ -53,7 +53,10 @@ import static com.google.common.base.Preconditions.checkState;
|
||||
* are building a wallet, how to present confidence to your users is something to consider carefully.</p>
|
||||
*/
|
||||
public class Transaction extends ChildMessage implements Serializable {
|
||||
/** A comparator that can be used to sort transactions by their updateTime field. */
|
||||
/**
|
||||
* A comparator that can be used to sort transactions by their updateTime field. The ordering goes from most recent
|
||||
* into the past.
|
||||
*/
|
||||
public static final Comparator<Transaction> SORT_TX_BY_UPDATE_TIME = new Comparator<Transaction>() {
|
||||
@Override
|
||||
public int compare(final Transaction tx1, final Transaction tx2) {
|
||||
|
@ -2294,13 +2294,8 @@ public class Wallet extends BaseTaggableObject implements Serializable, BlockCha
|
||||
numTransactions = size;
|
||||
}
|
||||
ArrayList<Transaction> all = new ArrayList<Transaction>(getTransactions(includeDead));
|
||||
// Order by date.
|
||||
Collections.sort(all, Collections.reverseOrder(new Comparator<Transaction>() {
|
||||
@Override
|
||||
public int compare(Transaction t1, Transaction t2) {
|
||||
return t1.getUpdateTime().compareTo(t2.getUpdateTime());
|
||||
}
|
||||
}));
|
||||
// Order by update time.
|
||||
Collections.sort(all, Transaction.SORT_TX_BY_UPDATE_TIME);
|
||||
if (numTransactions == all.size()) {
|
||||
return all;
|
||||
} else {
|
||||
|
Loading…
Reference in New Issue
Block a user