Stream.of() creates a stream from the array. map maps every element of the stream to an Integer using Integer::parseInt. Using mapToInt, you can create an Intstream, which is a specialization of streams for integer primitives. Integer[]::new is a method reference to an array constructor.
This assumes all elements of the array are parseable, if not it will throw an exception.
Join MindStick Community
You need to log in or register to vote on answers or questions.
We use cookies to ensure you have the best browsing experience on our website. By using our site, you
acknowledge that you have read and understood our
Cookie Policy &
Privacy Policy.
Can you answer this question?
Write Answer1 Answers