orderedList() (new in 4.0.M4) creates a new ArrayList containing the elements 
of the passed list, orders it and returns it (instead of ordering the passed 
List in place like orderList()).
The new List is created by invoking an ArrayList constructor that accepts a 
Collection as an argument, so I think it seems OK for the Ordering API to 
accept a Collection rather than a List.

orderList() would still only accept Lists (as you point out, that only makes 
sense).

Just so happened I had to turn a Set into a sorted List yesterday, hence the 
suggestion :).

Cheers,
- hugi


> On 3. ágú. 2016, at 14:23, Michael Gentry <[email protected]> wrote:
> 
> Are there non-List collections that need to be handled?  Maps and Sets
> generally cannot be ordered (yes, LinkedHashMap and LinkedHashSet can be,
> but they are less efficient and I don't believe Cayenne creates those for
> relationships) and we don't support Stacks or Queues.
> 
> Thanks,
> 
> mrg
> 
> 
> On Wed, Aug 3, 2016 at 2:35 AM, Andrus Adamchik <[email protected]>
> wrote:
> 
>> I've no objections to a more generic API here. The only consideration is
>> that "orderList" does in-place ordering. A Collection argument on the other
>> hand will need to be cloned into a list before ordering. Otherwise open to
>> suggestions.
>> 
>> Andrus
>> 
>>> On Aug 3, 2016, at 1:33 AM, Hugi Thordarson <[email protected]> wrote:
>>> 
>>> Hi all,
>>> just wondering if Ordering.orderedList( List ) should accept a
>> Collection rather than a List? Looks like it can be done only by modifying
>> the signature of the method.
>>> 
>>> Cheers,
>>> - hugi
>> 
>> 

Reply via email to