stream collect to string code example
Example: java stream collect to string
List<Integer> numbers = Arrays.asList( 4, 8, 15, 16, 23, 42 );
return numbers.stream()
.map( n -> n.toString() )
.collect( Collectors.joining( "," ) );
List<Integer> numbers = Arrays.asList( 4, 8, 15, 16, 23, 42 );
return numbers.stream()
.map( n -> n.toString() )
.collect( Collectors.joining( "," ) );