Tan-JiaLiang commented on PR #30:
URL: 
https://github.com/apache/flink-connector-hbase/pull/30#issuecomment-1780353338

   @ferenc-csaky Thanks for enlighten, make it object-oriented. I left my 
thoughts about this. Is it more meaningful?
   
   ```java
   /**
    * Grouped mutations by rows and keep the latest mutation. For more info, 
see <a
    * href="https://issues.apache.org/jira/browse/HBASE-8626";>HBASE-8626</a>.
    */
   private static class DeduplicatedMutations {
   
       private final Map<ByteBuffer, Mutation> mutations;
   
       DeduplicatedMutations(int size) {
           mutations = new HashMap<>(size);
       }
   
       void add(Mutation current) {
           ByteBuffer key = ByteBuffer.wrap(current.getRow());
           Mutation old = mutations.get(key);
           if (old == null || current.getTimeStamp() >= old.getTimeStamp()) {
               mutations.put(key, current);
           }
       }
   
       List<Mutation> getAll() {
           return new ArrayList<>(mutations.values());
       }
   
       void clear() {
           mutations.clear();
       }
   }
   ```


-- 
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: issues-unsubscr...@flink.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to