简体   繁体   中英

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.

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

Collections.sort(myList,myComparatorInstance);

do sort using a certain field.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM