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



##########
File path: 
hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/util/Sets.java
##########
@@ -0,0 +1,329 @@
+/*
+ * 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;
+
+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.SortedSet;
+import java.util.TreeSet;
+import java.util.concurrent.ConcurrentHashMap;
+
+/**
+ * Static utility methods pertaining to {@link Set} instances.
+ * This class is Hadoop's internal use alternative to Guava's Sets
+ * utility class.
+ */
[email protected]
+public final class Sets {
+
+  private Sets() {
+    // empty
+  }
+
+  /**
+   * Creates a <i>mutable</i>, initially empty {@code HashSet} instance.
+   *
+   * <p><b>Note:</b> if mutability is not required, use ImmutableSet#of()
+   * instead. If {@code E} is an {@link Enum} type, use {@link EnumSet#noneOf}
+   * instead. Otherwise, strongly consider using a {@code LinkedHashSet}
+   * instead, at the cost of increased memory footprint, to get
+   * deterministic iteration behavior.
+   */
+  public static <E> HashSet<E> newHashSet() {
+    return new HashSet<E>();
+  }
+
+  /**
+   * Creates a <i>mutable</i>, empty {@code TreeSet} instance sorted by the
+   * natural sort ordering of its elements.
+   *
+   * <p><b>Note:</b> if mutability is not required, use ImmutableSortedSet#of()
+   * instead.
+   *
+   * @return a new, empty {@code TreeSet}
+   */
+  public static <E extends Comparable> TreeSet<E> newTreeSet() {
+    return new TreeSet<E>();
+  }

Review comment:
       Sure thing, once this lands, I will create these sub-tasks:
   1. Replace Guava Sets by Hadoop's own Sets for each module: HDFS, Yarn, 
MapReduce
   2. Replace Sets#newHashSet and Sets#newTreeSet by directly using the 
respective constructors (with label: beginners) for each module: HDFS, Hadoop 
Common, Hadoop Tools, Yarn, MapReduce




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