Hi Oscar! 

I'm using java.util.List. Is it better to use a SortedSet collection?

thanks!
Leandro



> Subject: Re: Sorted collection
> From: [email protected]
> Date: Mon, 29 Sep 2014 16:01:55 +0200
> To: [email protected]
> 
> 
> Hi, Leandro.
> 
> Are you returning a SortedSet instead of simply a Set?
> 
> If so, you can customize the order by:
> 1. implementing a compareTo method that takes the order you want,
> 2. defining a custom sorting for the collection.
> 
> For both cases, you will find examples on the ToDoItem class on [1]. There, 
> search for:
> 
> 1. --> public int compareTo(final ToDoItem other) {
> 2. --> @SortedBy(DependenciesComparator.class)
> 
> And see the comments.
> 
> 
> HTH,
> 
> Oscar
> 
> 
> [1] 
> https://github.com/apache/isis/blob/master/example/application/todoapp/dom/src/main/java/dom/todo/ToDoItem.java
> 
> 
> 
> 
> El 29/09/2014, a las 15:57, Leandro Torroija <[email protected]> escribió:
> 
> > hi everybody!
> > 
> > When you have selected an object, which has a collection. Is there any way 
> > to sort these objects by criteria?
> > Or do I have to create a ViewModel and fill the collection already sorted 
> > through a query to the database?
> > 
> > Thanks! 
> > 
> > Leandro.
> >                                       
> 
> 
> 
> 
> 
                                          

Reply via email to