virajjasani commented on a change in pull request #2985:
URL: https://github.com/apache/hadoop/pull/2985#discussion_r629478452



##########
File path: 
hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/util/nonguava/Sets.java
##########
@@ -0,0 +1,258 @@
+/*
+ * 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
+ *
+ *     http://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.hadoop.util.nonguava;
+
+import org.apache.hadoop.classification.InterfaceAudience;
+
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.EnumSet;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.LinkedHashSet;
+import java.util.Set;
+import java.util.TreeSet;
+import java.util.concurrent.ConcurrentHashMap;
+
+/**
+ * Static utility methods pertaining to {@link Set} instances. This class is
+ * Hadoop's internal utility and replacement of
+ * org.apache.hadoop.thirdparty.com.google.common.collect.Sets.

Review comment:
       Sure, seems better

##########
File path: 
hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice-hbase-tests/src/test/java/org/apache/hadoop/yarn/server/timelineservice/reader/TestTimelineReaderWebServicesHBaseStorage.java
##########
@@ -262,20 +263,24 @@ private static void loadData() throws Exception {
     event54.setTimestamp(cTime);
     entity5.addEvent(event54);
     Map<String, Set<String>> isRelatedTo1 = new HashMap<String, Set<String>>();
-    isRelatedTo1.put("type2",
-        Sets.newHashSet("entity21", "entity22", "entity23", "entity24"));
-    isRelatedTo1.put("type4", Sets.newHashSet("entity41", "entity42"));
-    isRelatedTo1.put("type1", Sets.newHashSet("entity14", "entity15"));
-    isRelatedTo1.put("type3",
-        Sets.newHashSet("entity31", "entity35", "entity32", "entity33"));
+    isRelatedTo1.put("type2", new HashSet<>(Arrays.asList("entity21", 
"entity22",
+        "entity23", "entity24")));
+    isRelatedTo1.put("type4", new HashSet<>(Arrays.asList("entity41",
+        "entity42")));
+    isRelatedTo1.put("type1", new HashSet<>(Arrays.asList("entity14",
+        "entity15")));
+    isRelatedTo1.put("type3", new HashSet<>(Arrays.asList("entity31",
+        "entity35", "entity32", "entity33")));

Review comment:
       This module doesn't have dependency on `hadoop-common` unfortunately.

##########
File path: 
hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/JournalSet.java
##########
@@ -659,7 +660,7 @@ public synchronized RemoteEditLogManifest 
getEditLogManifest(long fromTxId) {
         // storage directory with ancient logs. Clear out any logs we've
         // accumulated so far, and then skip to the next segment of logs
         // after the gap.
-        SortedSet<Long> startTxIds = Sets.newTreeSet(logsByStartTxId.keySet());
+        SortedSet<Long> startTxIds = new TreeSet<>(logsByStartTxId.keySet());

Review comment:
       Yeah let me keep `Sets.newTreeSet` then. The only reason behind this is 
less no of such instances, but having it would be better.

##########
File path: 
hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/util/nonguava/Sets.java
##########
@@ -0,0 +1,258 @@
+/*
+ * 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
+ *
+ *     http://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.hadoop.util.nonguava;

Review comment:
       Sounds good.




-- 
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:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to