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.
create a new list of "AccountInfo" which contain "id" same as the "id" of >meetings
What do want to do if id's are same, merge in a new variable?
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.