How to convert a Java 8 Stream to an Array?
What is the easiest/shortest way to convert a Java 8 Stream into an array? 10 s 10 The easiest method is to use the toArray(IntFunction<A[]> generator) method with an array constructor reference. This is suggested in the API documentation for the method. String[] stringArray = stringStream.toArray(String[]::new); What it does is find a method that takes … Read more