Stream.of creates a stream from supplied elements. A common mistake is using Stream.of(list) when the intended stream should contain the list’s elements; use list.stream() for a collection. section 8.2
The collection-is-one-element mistake
Incorrect: Stream.of(list) .filter(e -> e instanceof Number) .forEach(num -> processNumber((Number) num)); Here, the stream receives the list as a single element, so its elements are not processed individually. Use list.stream() when processing the collection contents. section 8.2
