Kris-10-0 commented on a change in pull request #7389: URL: https://github.com/apache/geode/pull/7389#discussion_r815167406
########## File path: geode-for-redis/src/main/java/org/apache/geode/redis/internal/data/RedisList.java ########## @@ -42,16 +45,65 @@ public RedisList() { this.elementList = new SizeableByteArrayList(); } + /** + * @param start start index of desired elments + * @param stop stop index of desired elments + * @return list of elements in the range (inclusive). + */ + public List<byte[]> lrange(int start, int stop) { + start = transformNegIndexToPosIndex(start); + stop = transformNegIndexToPosIndex(stop); + + // Out of range negative index changes to 0 + start = Math.max(0, start); + + int elementSize = elementList.size(); + if (start > stop || elementSize <= start) { Review comment: This checks if the start is greater than the element size. But I can move the normalization of stop before the check. -- 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: notifications-unsubscr...@geode.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org