DonalEvans commented on a change in pull request #6768:
URL: https://github.com/apache/geode/pull/6768#discussion_r697792506



##########
File path: 
geode-apis-compatible-with-redis/src/main/java/org/apache/geode/redis/internal/data/RedisSortedSet.java
##########
@@ -750,10 +750,11 @@ protected int sizeValue(OrderedSetEntry value) {
 
     public void toData(DataOutput out) throws IOException {
       InternalDataSerializer.writePrimitiveInt(size(), out);
-      for (int pos = n; pos-- != 0;) {
-        if (value[pos] != null) {
-          byte[] member = value[pos].getMember();
-          byte[] score = value[pos].getScoreBytes();
+      for (int pos = getMaxIndex(); pos-- != 0;) {

Review comment:
       Since there needs to be one more round of changes to fix the integration 
tests, could this for loop instead be:
   ```
   for (int pos = getMaxIndex() - 1; pos >= 0; pos--) {
   ```
   to make it more consistent with the rest of the module? It's a little 
clunkier, but for me, at least, is easier to understand at a glance. 
Alternately, since the order in which we iterate through the collection doesn't 
matter here, it could be:
   ```
   for (int pos = 0; pos < getMaxIndex(); ++pos) {
   ```
   which is much clearer, I think.
   The same would apply to the loop in `RedisHash.toData()` if you choose to 
change this




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to