Why does Java8 Stream generate nothing?

Solution 1:

You don't have any terminal operation consuming your stream. So nothing happens. map() is an intermediate operation, which is not supposed to have side effects. What your code should be is

queue.stream().forEach(s-> {
    System.out.println("queue: "+ s);
});

Solution 2:

The map() method itself is intermediate and does not enforce the consumption of a Stream so it's a very bad idea to put side effects there.

In this case, you should use the dedicated forEach() method:

queue.stream()
  .forEach(s -> System.out.println("queue: " + s));