for(int j=0; j<subset.size(); j++) {
// ZSetEntry uses byte[] as baseline for value
// since we know we put Strings in the set, we can go ahead and decode the byte[] and get our String value back
// value is just a double (primitive).
ZSetEntry e = subset.get(j);
String value = DefaultCodec.toStr(e.getValue());
System.out.format("\t[%03d]: {value: %s score: %1.19f}\n", j, value, e.getScore());
}
// & now let's get the subset in range {0, 10} in ascending order
//
List<ZSetEntry> revsubset = jredis.zrevrangeSubset(zset, 0, 10);
System.out.format ("\n\n%s elements from 0 to 10 - reverse order:\n\t---\n", zset);
for(int j=0; j<revsubset.size(); j++) {
ZSetEntry e = revsubset.get(j);
String value = DefaultCodec.toStr(e.getValue());
System.out.format("\t[%03d]: {value: %s score: %1.19f}\n", 100-j, value, e.getScore());
}
}
catch (RedisException e) { e.printStackTrace(); }
}