Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVA

stream reduce stringbuilder

List<Person> list = Arrays.asList(
  new Person("John", "Smith"),
  new Person("Anna", "Martinez"),
  new Person("Paul", "Watson ")
);

String joinedFirstNames = list.stream()
  .map(Person::getFirstName)
  .collect(Collectors.joining(", ")); // "John, Anna, Paul"
Source by www.it-swarm.dev #
 
PREVIOUS NEXT
Tagged: #stream #reduce #stringbuilder
ADD COMMENT
Topic
Name
9+6 =