Is an order stored in a set when restoring sorted sets using jedis?

I am using the Redis "Jedis" Java client.

When receiving a sorted set using zrange, for example, the client indicates that it returns a Set, which by definition does not have a guarantee of confirmation.

this old question mentions the problem, but I did not find a link to its resolution.

Can I do this and know that the order will be kept?

Set<String> results = jedisCli.zrange(key, start, end);
MyObject[] requestedOrderedObjects = new MyObject[results.size];
int i = 0;
foreach(String result: results) {
    requestedOrderedObjects[i++] = MyObject.loadFromString(result);
}
return requestedOrderedObjects;

Thanks for any help.

+4
source share
1 answer

, Set jedis : SortedSet . : API , , : , .

+3

Source: https://habr.com/ru/post/1536419/


All Articles