I have the following class:
public class Transfer { private String fromAccountID; private String toAccountID; private double amount; }
and a List of Transfer s:
.... private List<Transfer> transfers = new ArrayList<>();
I know how to get the migration history:
transfers.stream().filter(transfer -> transfer.getFromAccountID().equals(id)).findFirst().get();
But I want to get fromAccountID and toAccountID , so the result will be List of Transfer s. How can I do this using the functions of the Java8 Stream filter?
source share