Is the following statement true?

> 
> The `sorted()` operation is a “stateful intermediate operation”, which means that subsequent operations no longer operate on the backing collection, but on an internal state.
> 
> 
> 

([Source](https://www.toptal.com/java/top-10-most-common-java-development-mistakes) and [source](https://dzone.com/articles/java-8-friday-10-subtle) - they seem to copy from each other or come from the same source.)

**Disclaimer:** I am aware the following snippets are not legit usages of Java Stream API. Don't use in the production code.

I have tested [`Stream::sorted`](https://docs.oracle.com/javase/8/docs/api/java/util/stream/Stream.html#sorted--) as a snippet from sources above:

```
final List<Integer> list = IntStream.range(0, 10).boxed().collect(Collectors.toList());

list.stream()
    .filter(i -> i > 5)
    .sorted()
    .forEach(list::remove);

System.out.println(list);            // Prints [0, 1, 2, 3, 4, 5]

```

It works. I replaced [`Stream::sorted`](https://docs.oracle.com/javase/8/docs/api/java/util/stream/Stream.html#sorted--) with [`Stream::distinct`](https://docs.oracle.com/javase/8/docs/api/java/util/stream/Stream.html#distinct--), [`Stream::limit`](https://docs.oracle.com/javase/8/docs/api/java/util/stream/Stream.html#limit-long-) and [`Stream::skip`](https://docs.oracle.com/javase/8/docs/api/java/util/stream/Stream.html#skip-long-):

```
final List<Integer> list = IntStream.range(0, 10).boxed().collect(Collectors.toList());

list.stream()
    .filter(i -> i > 5)
    .distinct()
    .forEach(list::remove);          // Throws NullPointerException

```

To my surprise, the `NullPointerException` is thrown.

All the tested methods follow the [stateful intermediate operation](https://docs.oracle.com/javase/8/docs/api/java/util/stream/package-summary.html#StreamOps) characteristics. Yet, this unique behavior of [`Stream::sorted`](https://docs.oracle.com/javase/8/docs/api/java/util/stream/Stream.html#sorted--) is not documented nor the [Stream operations and pipelines](https://docs.oracle.com/javase/8/docs/api/java/util/stream/package-summary.html#StreamOps) part explains whether the *stateful intermediate operations* really guarantee a new source collection.

Where my confusion comes from and what is the explanation of the behavior above?