I have a list consists of multiple objects and I want to concatenate two objects in that list with a delimiter based on a common object value?

Viewed 22
//I have a list:
List<StudentClass> res = new ArrayList<>();

//res looks like this:
 "StudentClass(ob1= 1234, ob2= "random", ob3= "abc")"
 "StudentClass(ob1= 1234, ob2= "something", ob3= "def")"
 "StudentClass(ob1= 567, ob2= "xyzzy", ob3= "yyy")"

Blockquote

Based on the common object ob1, I want to combine ob3 with a delimiter ","

//Expected output of res:
 "StudentClass(ob1= 1234, ob2= "random", ob3= "abc,def")"
 "StudentClass(ob1= 567, ob2= "xyzzy", ob3= "yyy")"
0 Answers
Related