stream reduce stringbuilder

Solutions on MaxInterview for stream reduce stringbuilder by the best coders in the world

showing results for - "stream reduce stringbuilder"
Mailys
24 Jun 2016
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