How to get a Stream from a float[]

Here’s a better way, that doesn’t involve copying the data.

DoubleStream ds = IntStream.range(0, floatArray.length)
                           .mapToDouble(i -> floatArray[i]);

Leave a Comment