public < R > Stream < R > map ( final Func1 < ? super T , ? extends R > func ) { return new Stream < R > ( ) { @ Override public Iterator < R > iterator ( ) { return new ReadOnlyIterator < R > ( ) { Iterator < T > iterator = Stream . this . iterator ( ) ; @ Override public boolean hasNext ( ) { return iterator . hasNext ( ) ; } @ Override public R next ( ) { return func . call ( iterator . next ( ) ) ; } } ; } } ; }
Returns a new stream that contains items that has been returned by a given function for each item in the current stream .