-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTransactionSort.java
More file actions
31 lines (20 loc) · 1.18 KB
/
TransactionSort.java
File metadata and controls
31 lines (20 loc) · 1.18 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
package lambda;
import transactionexample.entity.Transaction;
import java.util.*;
public class TransactionSort {
public static void main(String[] args) {
TreeMap<Long, Transaction> allTransaction = new TreeMap<>((t1, t2)-> -t1.compareTo(t2));
allTransaction.put(101L, new Transaction(101L, 1000f,new Date(10,01,02),1));
allTransaction.put(104L, new Transaction(104L, 3000f,new Date(10,01,02),1));
allTransaction.put(103L, new Transaction(103L, 5000f,new Date(10,01,02),1));
allTransaction.put(109L, new Transaction(109L, 2000f,new Date(10,01,02),1));
allTransaction.put(108L, new Transaction(108L, 6000f,new Date(10,01,02),1));
System.out.println(allTransaction);
List<Transaction> transactionList = new ArrayList<>();
transactionList.add(new Transaction(101L, 1000f,new Date(10,01,02),1));
transactionList.add(new Transaction(104L, 3000f,new Date(10,01,02),1));
transactionList.add(new Transaction(103L, 5000f,new Date(10,01,02),1));
transactionList.add(new Transaction(109L, 2000f,new Date(10,01,02),1));
transactionList.add(new Transaction(108L, 6000f,new Date(10,01,02),1));
}
}