Hello everyone,
I want to know how this code operates fine.
Documentation from intellij Idea :
sorted :Returns a stream consisting of the elements of this stream, sorted according to natural order.
If the elements of this stream are not Comparable, a
java. lang. ClassCastException may be thrown when the terminal operation is executed