I have the following code:
Queue<Reward> possibleRewards =
Stream.of(Reward.values())
.flatMap(reward -> IntStream.range(0, reward.getOccurencies()).mapToObj(i -> reward))
.collect(Collectors.toList());
As you can see, I need to collect the elements of the Stream into a Queue, not a List. However, there's no Collectors.toQueue() method. How can I collect the elements into a Queue?