transactionId|age|amount|accType|
0000000000001|1 |1.0000|saving |
0000000000002|1 |1.0000|saving |
0000000000003|1 |1.0000|current|
How do I loop and group them by acc type using stream?
I want to have a map like below:
saving: [{0000000000001|1.0000|saving}, {0000000000002|1.0000|saving}]
current: [{0000000000003|1.0000|current}]
Currently I am doing the filtering without grouping:
txs.stream().filter(x -> x.getAge().equal(1)).filter(x -> x.getAmount().equals(1.0000)).collect(Collectors.toList());
I am trying:
Map<String, List<TX>> tx = txs.stream()
.collect(Collectors.groupingBy(p -> p.getAccountType()), Collectors.filtering(?))
How do I do multiple fitering?