We would like to know how to map IntSteam to String Object.
/* w w w . j a v a 2 s . c o m*/ import java.util.stream.IntStream; public class Main { public static void main(String[] args) throws Exception { IntStream.range(1, 4) .mapToObj(i -> "a" + i) .forEach(System.out::println); } }
The code above generates the following result.