1List<Person> list = Arrays.asList(
2 new Person("John", "Smith"),
3 new Person("Anna", "Martinez"),
4 new Person("Paul", "Watson ")
5);
6
7String joinedFirstNames = list.stream()
8 .map(Person::getFirstName)
9 .collect(Collectors.joining(", ")); // "John, Anna, Paul"
10