user1152327
user1152327

Reputation: 149

Sorting a query response from GAE datastore

I'm running a query on GAE's datastore:

List<Entity> messages =    
    datastore.prepare(query).asList(FetchOptions.Builder.withLimit(500)); 

I plan on manually adding a property to each message and would then like to sort the messages by the new property.

Any ideas on how to do this? Ideally I'd like to sort by multiple variables.

Upvotes: 1

Views: 205

Answers (1)

Shivan Dragon
Shivan Dragon

Reputation: 15229

Well you can make separate java.util.Comparator<SortPropertyType> implementations and then do a

Collections.sort(myList,myComparatorInstance);

do sort using a certain field.

Upvotes: 1

Related Questions