Join a list of object’s properties into a String
To retrieve a String consisting of all the ID’s separated by the delimiter “,” you first have to map the Person ID’s into a new stream which you can then apply Collectors.joining on. String result = personList.stream().map(Person::getId) .collect(Collectors.joining(“,”)); if your ID field is not a String but rather an int or some other primitive numeric … Read more