keith-turner commented on code in PR #3968:
URL: https://github.com/apache/accumulo/pull/3968#discussion_r1433262179


##########
core/src/main/java/org/apache/accumulo/core/iterators/user/HasWalsFilter.java:
##########
@@ -0,0 +1,40 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.accumulo.core.iterators.user;
+
+import java.util.EnumSet;
+import java.util.function.Predicate;
+
+import org.apache.accumulo.core.metadata.schema.TabletMetadata;
+
+public class HasWalsFilter extends TabletMetadataFilter {
+
+  private final static Predicate<TabletMetadata> HAS_WALS =
+      tabletMetadata -> !tabletMetadata.getLogs().isEmpty();
+
+  @Override
+  public EnumSet<TabletMetadata.ColumnType> getColumns() {
+    return EnumSet.of(TabletMetadata.ColumnType.LOGS);
+  }

Review Comment:
   I did not know that `EnumSet.copyOf()` existed.  Looking into it seems to be 
an old method that predates the addition of copyOf to Set and other collection 
interfaces.  AFAICT it was add in java 1.5 when enums were added, so its really 
old. Playing around with it in jshell and reading about it, what it returns is 
mutable.  That's a sharp edge in java, all of the new copyOf methods do return 
immutable collections but this older one does not.  I suppose another option 
for making it immutable is `Set.copyOf(EnumSet.of(...))`.



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

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

Reply via email to