jdeppe-pivotal commented on a change in pull request #7431:
URL: https://github.com/apache/geode/pull/7431#discussion_r822757911



##########
File path: 
geode-for-redis/src/main/java/org/apache/geode/redis/internal/data/collections/SizeableByteArrayList.java
##########
@@ -31,6 +33,57 @@
       roundUpSize(getObjectHeaderSize() + 3 * getReferenceSize());
   private int memberOverhead;
 
+  /**
+   * @param o element to remove from the list
+   * @param count number of elements that match object o to remove from the 
list.
+   *        Count that is equal to 0 removes all matching elements from the 
list.
+   * @return list of indexes that were removed in order.
+   */
+  public List<Integer> removeObjectsStartingAtHead(Object o, int count) {

Review comment:
       We have slightly separate code paths that are ultimately all dependent 
on whether count is positive or negative. Since this is a very specific use 
case we're creating these methods for, I think it would be cleaner to have this 
method receive either a positive or negative value and then do the appropriate 
thing. Also, the returned list should always be in the same order (ascending or 
descending) regardless of the value of count. That would simplify a lot of 
subsequent code.

##########
File path: 
geode-for-redis/src/main/java/org/apache/geode/redis/internal/data/collections/SizeableByteArrayList.java
##########
@@ -31,6 +33,57 @@
       roundUpSize(getObjectHeaderSize() + 3 * getReferenceSize());
   private int memberOverhead;
 
+  /**
+   * @param o element to remove from the list
+   * @param count number of elements that match object o to remove from the 
list.
+   *        Count that is equal to 0 removes all matching elements from the 
list.
+   * @return list of indexes that were removed in order.
+   */
+  public List<Integer> removeObjectsStartingAtHead(Object o, int count) {

Review comment:
       Please would you add some tests for the new methods in this class.




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