Class AccountInfo
{
String id;
String name;
String type;
}
Class MeetingsInfo
{
String id;
String count;
Date meetingDate;
}
List<AccountInfo> accounts;
List<MeetingsInfo> meetings;
Here "accounts" contain details of all accounts and meetings contain all meetings of that day. How to create a new list of "AccountInfo" which contain "id" same as the "id" of meetings using "map" function?
I tried to do it this way:
List<AccountInfo> newAccounts = accounts.stream().map(meetings::getAccountId);
Please do mention if there is any optimised method than using map.