Into
Doug Lea
dl at cs.oswego.edu
Wed Dec 26 08:01:15 PST 2012
On 12/26/12 10:51, Raab, Donald wrote:
> Just to clarify, if these methods are added to Stream, we won't have any conflicts, as our methods appear on our Collections. But I think it might still be good to clarify the names.
>
Sure. In the unlikely event that Brian agrees about going this route :-),
the names are up for grabs. I listed them this way because
we find that people don't like the name "Navigable"
(because it does not immediately imply sortedness
in people's minds) so the less often you are forced to use it the better.
But that's a minor concern.
(Note that several method names don't exactly
match up with return type names. There's no
j.u. name for List & RandomAccess, or for a Collection that is
not necessarily a List but unlike Set permits duplicates.
(Further aside: If there were, then Map.values() should use it
as well, but too late for that.))
-Doug
>> -----Original Message-----
>> From: Raab, Donald [Tech]
>> Sent: Wednesday, December 26, 2012 10:47 AM
>> To: 'Doug Lea'; 'lambda-libs-spec-experts at openjdk.java.net'
>> Subject: RE: Into
>>
>> We have methods to toSortedSet() and toSortedMap() that return SortedSet
>> and SortedMap (as the names imply). We remain compatible back to Java
>> 5, where NavigableSet and NavigableMap do not exist.
>>
>> I would request either calling the methods
>> toNavigableSet()/toNavigableMap() and returning
>> NavigableSet/NavigableMap or having both toSorted and toNavigable forms
>> and returning the appropriately named types.
>>
>>
>>>
>>> Object[] toArray();
>>> Set<T> toSet();
>>> List<T> toList();
>>> List<T> toRandomAccessList();
>>> List<T> toSortedList(Comparator<? super T> comparator);
>>> List<T> toSortedList();
>>> NavigableSet<T> toSortedSet();
>>> NavigableSet<T> toSortedSet(Comparator<? super T> comparator);
>>> Collection<T> toBag(); // unordered, possible dups
>>> <K> Map<K,T> toMap(Function<? super T,K> keyFn, BinaryOperator<T>
>>> mergeFn);
>>> <K> Map<K,<Collection<T>> toMap(Function<? super T,K> keyFn);
>>> <K> NavigableMap<K,T> toSortedMap(Function<? super T,K> keyFn,
>>> Comparator<? super K>
>> comparator,
>>> BinaryOperator<T> mergeFn);
>>> <K> NavigableMap<K,Collection<T>> toSortedMap(Function<? super
>>> T,K> keyFn,
>>> Comparator<? super
>>> K> comparator);
>
>
More information about the lambda-libs-spec-observers
mailing list