You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@accumulo.apache.org by GitBox <gi...@apache.org> on 2021/05/18 14:55:35 UTC

[GitHub] [accumulo] ctubbsii commented on a change in pull request #2112: Improve LocalityGroupUtil.java

ctubbsii commented on a change in pull request #2112:
URL: https://github.com/apache/accumulo/pull/2112#discussion_r634464641



##########
File path: core/src/main/java/org/apache/accumulo/core/util/LocalityGroupUtil.java
##########
@@ -377,11 +377,11 @@ public static void seek(FileSKVIterator reader, Range range, String lgName,
     if (lgName == null) {
       // this is the default locality group, create a set of all families not in the default group
       Set<ByteSequence> nonDefaultFamilies = new HashSet<>();
-      for (Entry<String,ArrayList<ByteSequence>> entry : localityGroupCF.entrySet()) {
-        if (entry.getKey() != null) {
-          nonDefaultFamilies.addAll(entry.getValue());
+      localityGroupCF.forEach((k, v) -> {
+        if (k != null) {
+          nonDefaultFamilies.addAll(v);
         }
-      }
+      });

Review comment:
       Is it possible to have null keys in the first place? If not, that check is probably redundant, and we could just stream the values. Something like `localityGroupCF.values().stream().forEach(nonDefaultFamilies::addAll);`
   
   If it is possible to have null keys, then your current code is probably fine.




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

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