I\'m trying to generate Order instances using the Stream API. I have a factory function that creates the order, and a DoubleStream is used to initialize the amount of the o
You should use Supplier function interface for your initialization like this
Supplier> streamSupplier = () -> (new Random().doubles(50.0, 200.0).boxed());
And change your way to get double like this
streamSupplier.get().findFirst().get()
Then it works normally.
Found this way from the post Stream has already been operated upon or closed Exception