Java 8 Streams Java Java API
Interface:
java.util.stream.IntStream
Method:
IntStream map(IntUnaryOperator mapper)
This intermediate operation, returns a stream consisting of the results of applying the given mapper function to the elements of this stream.
Examples
package com.logicbig.example.intstream;
import java.util.stream.IntStream;
public class MapExample {
public static void main(String... args) { IntStream intStream = IntStream.range(1, 5); IntStream intStream1 = intStream.map(i -> i * 2); intStream1.forEach(System.out::println); } }
Output2 4 6 8
|