inconsistent naming of Stream.sorted()?
Brian Goetz
brian.goetz at oracle.com
Thu May 23 08:02:05 PDT 2013
Sort of :)
"sorted" is an adjective as well: "This list is sorted". This is a
slightly different statement than "this list has been sorted", where
sorted is used as a past participle.
The intent of this naming choice was that the method would produce a
stream that has the property of being sorted. In that way, it is
consistent with:
Stream.sequential()
Stream.parallel()
Stream.unordered()
Stream.distinct()
Granted, there are two subgroups here; one is sorted and distinct, where
the named attribute describes the *elements*, and the others describe a
property of the the *stream*, but I don't really see it as being
inconsistent.
I think calling it "sort" would be much worse. (Then we'd have to
rename distinct to something like makeDistinct or removeDuplicates or
filterDuplicates.)
On 5/23/2013 10:40 AM, Gernot Neppert wrote:
> Hi,
>
> I've been testing build 90 of JDK 1.8, and I came up with this question:
>
> Stream.sorted is the only method that uses the past participle form of the
> verb that describes it.
> All others, (such as filter, map, etc.) simply use the infinitive.
>
> Was this a deliberate decision or an an oversight?
>
More information about the lambda-dev
mailing list