I'm making a Set of objects that consists of name and value. My requirement is to create a new Set by grouping the Set based on objects that have the same value and concate the property name into a single string separated by ",".
Example:
Name: Test, value: Random value
Name: Test 2, value: Some random value
Name: Test 3, value: Random value
I want the result to be a Set like this:
Name: Test, Test 3, value: Random value
Name: Test 2 , value: Some random value
The class for understanding:
public class Test {
private String name;
private String value;
}
How to create a new Set by grouping the Set based on value and concatenate the name into a string using Java Stream?