sorting - sort a list of @Sortable objects in descending order -


i have class

@sortable(includes = ['date']) class item {   // other fields not relevant question   date date } 

if sort list of these objects sort them in ascending order based on date field. there way sort them in descending order instead? know call reverse() on result of ascending sort, seems bit inefficient

here couple of ways:

def items = [ new item(date: new date(40000)), new item(date: new date(1000)), new item(date: new date(200000)), new item(date: new date(00100)), ]  items.sort { a, b -> b <=> }      items.sort(true, collections.reverseorder()) 

Comments

Popular posts from this blog

c++ - Difference between pre and post decrement in recursive function argument -

php - Nothing but 'run(); ' when browsing to my local project, how do I fix this? -

php - How can I echo out this array? -