import java.util.Comparator; import java.util.PriorityQueue; public class TestPQ { public static void main(String[] args){ Comparator com
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.
Stream
In this case, you should use the dedicated forEach() method:
queue.stream() .forEach(s -> System.out.println("queue: " + s));