public <V extends Comparable<? super V>> LongStreamEx sortedBy(LongFunction<V> keyExtractor) {
        return sorted(Comparator.comparing(keyExtractor::apply));
    }
public < V extends Comparable < ? super V > > LongStreamEx sortedBy ( LongFunction < V > keyExtractor ) { return sorted ( Comparator . comparing ( keyExtractor :: apply ) ) ; }
Returns a stream consisting of the elements of this stream, sorted
according to the natural order of the keys extracted by provided
function.

<p>
For ordered streams, the sort is stable. For unordered streams, no
stability guarantees are made.

<p>
This is a <a href="package-summary.html#StreamOps">stateful intermediate
operation</a>.

@param <V> the type of the {@code Comparable} sort key
@param keyExtractor a
<a href="package-summary.html#NonInterference">non-interfering
</a>, <a href="package-summary.html#Statelessness">stateless</a>
function to be used to extract sorting keys
@return the new stream