I have a List of objects. each object has two properties.
- name
- idSet
Example:
1. name = "CH2OH" idSet = "223"
2. name = "CH2CH2OH" idSet = "255,310"
3. name = "CH2OH" idSet = "223,256"
4. name = "CH2OH" idSet = "223,256,295"
1,3 and 4 have same name but different idList. But 3 contains 1's idList item + a new id, and 4 has 3's idList + a new one.
I want to get a list or stream, with the name as a key and idList as it's value. However, the idList should always get maximum
expected out put according to the example
- name = "CH2CH2OH" idSet = "255,310"
- name = "CH2OH" idSet = "223,256,295"
How can I get it by using java 8. I have tried this. but the problem is it is getting distinct stream by considering only one property. Its randomly getting one and eliminate others. I want to get stream by considering two properties.Thanks