I am trying to convert List<Object> to Map<String, List> using Streams,
public class User{
String name;
String age;
String org;
}
I have List<Users>, and need to collect into Map<String, Object> m,
m.put("names", List of names,);
m.put("age", List of age);
m.put("org", List of org);
to be use in named query -> eg: select * from table ... where names in (:names) and age in (:age) and org in (:org)
as of now I am doing like
List<String> names = userList.stream().map(User::getName).collect(Collectors.toList());
List<String> age= userList.stream().map(User::getAge).collect(Collectors.toList());
List<String> org= userList.stream().map(User::getName).collect(Collectors.toList());
How to collect all the values while streaming to the list only once ?
List<User>so not use to understand all