dschneider-pivotal commented on a change in pull request #6768:
URL: https://github.com/apache/geode/pull/6768#discussion_r697796119



##########
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:
       The for loop expression came from the original code. I just added the 
accessor method getMaxIndex instead of using "n". I agree your way is easier to 
understand. I was worried about changing it and introducing an off by 1 error.




-- 
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