Person elpidio = new Person.Builder().id(3L).firstName("elpidio").secondName("gomez").ext("121").build();
Person romual1 = new Person.Builder().id(4L).firstName("romualdo").secondName("perez").ext("141").build();
Person romual2 = new Person.Builder().id(4L).firstName("romualdo").secondName("perez").ext("144").build();
Now I need a out put some thing like this.
[Person [firstName=elpidio, secondName=gomez,ext=[121]],
Person [firstName=romualdo, secondName=perez,ext=[121,144]]]
I refereed to below ans. But the problem I found is that I have many property in Person, and out of that I just need to merge one fields. So the entry set is giving issue. Any suggestion in welcome.
Extract duplicate objects from a List in Java 8
How to merge child objects in list based on duplicate parent object