IntStream mapToObj() returns an object-valued Stream consisting of the results of applying the given function.
Note : IntStream mapToObj() is a intermediate operation. These operations are always lazy. Intermediate operations are invoked on a Stream instance and after they finish their processing, they give a Stream instance as output.
<U> Stream<U> mapToObj(IntFunction<? extends U> mapper)
- U : The element type of the new stream.
- Stream : A sequence of elements supporting sequential and parallel aggregate operations.
- IntFunction : Represents a function that accepts an int-valued argument and produces a result.
- mapper : A stateless function to apply to each element.
Return Value : The function returns an object-valued Stream consisting of the results of applying the given function.
Example 1 :
11 100 101 110 111
Example 2 :
13 15 17 19 21
- DoubleStream mapToObj() in Java
- LongStream mapToObj() in Java
- IntStream of() in Java
- IntStream sum() in Java
- IntStream boxed() in Java
- IntStream builder() in Java
- IntStream mapToDouble() in Java
- IntStream asLongStream() in Java
- IntStream limit() in Java
- IntStream summaryStatistics() in Java
- IntStream mapToLong() in Java
- IntStream sequential() in Java
- IntStream max() in Java with examples
- IntStream min() in Java with Examples
- IntStream findFirst() in Java
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.