I’m curious if there’s an elegant (stream-only) way to return a partially sorted stream where the first n matching elements of some predicate are at the front, and the rest of the elements follow.
It’s simple enough to have all matching elements of some predicate at the front (just reverse sort them by a boolean comparator on the predicate), but to have only a limited number of matches at the front seems much harder…