Java 8 Streams Java Java API
java.util.stream.LongStream
IntStream mapToInt(LongToIntFunction mapper)
This intermediate operation returns an IntStream consisting of the results of applying the given function to the elements of this stream.
IntStream
package com.logicbig.example.longstream;import java.util.stream.IntStream;import java.util.stream.LongStream;public class MapToIntExample { public static void main(String... args) { LongStream stream = LongStream.of(4, 7, 9, 11, 13, 17); IntStream intStream = stream.mapToInt(Math::toIntExact); intStream.forEach(System.out::println); }}
479111317