Search code examples
javasortinghazelcastpredicates

Have hazelcast predicate return sorted collection


is there a way to get a sorted collection from a hazelcast predicate? i have found that hazelcast offers a pagingpredicate for this purpose but i am not interested in the paging behavior (at least for now).

even if one does use this pagingpredicate, does it make sure that the whole collection is sorted and not just the items in a particular page? and also if there is any way to disable the paging completely?

i am interested in getting the results in sorted form and not in sorting the distributed data structure.

thank you


Solution

  • i ran a few tests with pagingpredicate and it did exactly what i wanted.

    pagesize should be selected carefully. small page size with big data can cause huge number of comparisons with lots of data travel between hazelcast nodes.

    at the end, all the items in the resulting collection are perfectly sorted, including the ones in any given page of course.

    hope someone will find it useful.