Question: ```
import java.util.Comparator;
import java.util.PriorityQueue;

public class TestPQ {
    public static void main(String[] args){
        Comparator<String> comparator = new StringLengthComparator();
        PriorityQueue<String> queue = new PriorityQueue<String>(10, comparator);
        queue.offer("Short");
        queue.offer("ABCahahahha");
        queue.offer("lululu");
        queue.stream().map( s-> {
            System.out.println("queue: "+ s);
            return s;
        });
    }
}

```

I have this code and I expect that I would see "Short", "lululu" and "ABCahahahha" been printed out.
But I don't see them. what's wrong with my code?
Compile is fine. and I am using java 8 compiler and runtime.

Answer: 
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);
});

```
non terminal operation is not doing any processing. Its the terminal operation only, who start the processing of all the non terminal operation and then finally terminal operation.