public < R > Stream < R > map ( Function < ? super T , ? extends R > mapper ) { List < R > list = new ArrayList < R > ( ) ; while ( iterator . hasNext ( ) ) { list . add ( mapper . apply ( iterator . next ( ) ) ) ; } return Stream . of ( list ) ; }
Returns a stream consisting of the results of applying the given function to the elements of this stream .