I have a list of objects which contains the medium of transaction and transaction amount. I want to find the total amount for particular transaction.
For example- I have the following objects in list -
Credit card 10
Debit card 20
Credit card 30
Credit card 20
Debit card 20
Digital Wallet 30
Debit card 40
I want output like this -
Credit Card 60
Debit card 80
Digital Wallet 30
I want it to do using Java 8 stream. Can anyone please help!