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
Your method could be a one-liner like this instead. You need to use mapToObj, not map
mapToObj
map
private List createOrders(int numberOfOrders) { return doubleStream.limit(numberOfOrders).mapToObj(Order::new).collect(Collectors.toList()); }