class Employee{
private Integer employeeId;
private Integer projectId;
private String mobileNumbers;
}
I want to convert List of employees to Map of projectId & mobile numbers. Mobile numbers can have multiple values comma separated(eg: mobileNumbers="7364567347,5784345445")
I want to split mobile number with partition of 100. Hence the value datatype is Set<Set>
Two things which I am not able to achieve in Java 8 using stream 1.Not able to split multiple mobileNumber as individual element in Set object. 2.Not able to partition
Eg:
Employee[employeeId=1,projectId=1,mobileNumbers="1111,2222"]
Employee[employeeId=2,projectId=1,mobileNumbers="33333"]
Employee[employeeId=3,projectId=2,mobileNumbers="44444,5555"]
Expected : {1=[["1111","2222","33333"]], 2=[["44444","5555"]]}
I am able to proceed till Map<ProjectId,Set>. I am not able to split mobileNumbers
Map<Integer,Set<String>> result2=employeeList.stream()
.collect(
Collectors.groupingBy(Employee::getProjectId,
Collectors.mapping(Employee::getMobileNumbers, Collectors.toSet()))
);
Two things which I am not able to achieve in Java 8 using stream 1.Not able to split multiple mobileNumber as individual element in Set object. 2.Not able to partition `