You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@hbase.apache.org by GitBox <gi...@apache.org> on 2022/07/26 00:26:45 UTC

[GitHub] [hbase] apurtell commented on a diff in pull request #4647: HBASE-27234 Clean up error-prone warnings in hbase-examples

apurtell commented on code in PR #4647:
URL: https://github.com/apache/hbase/pull/4647#discussion_r929422515


##########
hbase-examples/src/main/java/org/apache/hadoop/hbase/coprocessor/example/RowCountEndpoint.java:
##########
@@ -118,24 +117,18 @@ public void getKeyValueCount(RpcController controller, CountRequest request,
       scanner = env.getRegion().getScanner(new Scan());
       List<Cell> results = new ArrayList<>();
       boolean hasMore = false;
-      long count = 0;
+      MutableLong count = new MutableLong();
       do {
         hasMore = scanner.next(results);
-        for (Cell kv : results) {
-          count++;
-        }
+        results.forEach((r) -> count.increment());

Review Comment:
   Or Iterables.size like you suggested on the review of hbase-endpoint. 



-- 
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-unsubscribe@hbase.apache.org

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