Switch back to removal-efficient collections.

Change-Id: I1d9858db942feb9842eda73b9bcd3302ef1e286b
diff --git a/src/main/java/com/android/tools/r8/ir/conversion/MethodProcessor.java b/src/main/java/com/android/tools/r8/ir/conversion/MethodProcessor.java
index 40ba4c1..a7933d2 100644
--- a/src/main/java/com/android/tools/r8/ir/conversion/MethodProcessor.java
+++ b/src/main/java/com/android/tools/r8/ir/conversion/MethodProcessor.java
@@ -77,7 +77,7 @@
    * <p>All nodes in the graph are extracted if called repeatedly until null is returned. Please
    * note that there are no cycles in this graph (see {@link CycleEliminator#breakCycles}).
    */
-  static void extractLeaves(Iterable<Node> nodes, Consumer<Node> fn) {
+  static void extractLeaves(Set<Node> nodes, Consumer<Node> fn) {
     Set<Node> removed = Sets.newIdentityHashSet();
     Iterator<Node> nodeIterator = nodes.iterator();
     while (nodeIterator.hasNext()) {
diff --git a/src/main/java/com/android/tools/r8/ir/conversion/PostMethodProcessor.java b/src/main/java/com/android/tools/r8/ir/conversion/PostMethodProcessor.java
index dab85a9..13566359 100644
--- a/src/main/java/com/android/tools/r8/ir/conversion/PostMethodProcessor.java
+++ b/src/main/java/com/android/tools/r8/ir/conversion/PostMethodProcessor.java
@@ -17,7 +17,7 @@
    *
    * <p>All nodes in the graph are extracted if called repeatedly until null is returned.
    */
-  static void extractRoots(Iterable<Node> nodes, Consumer<Node> fn) {
+  static void extractRoots(Set<Node> nodes, Consumer<Node> fn) {
     Set<Node> removed = Sets.newIdentityHashSet();
     Iterator<Node> nodeIterator = nodes.iterator();
     while (nodeIterator.hasNext()) {
diff --git a/src/test/java/com/android/tools/r8/ir/conversion/NodeExtractionTest.java b/src/test/java/com/android/tools/r8/ir/conversion/NodeExtractionTest.java
index f8f883e..2cde812 100644
--- a/src/test/java/com/android/tools/r8/ir/conversion/NodeExtractionTest.java
+++ b/src/test/java/com/android/tools/r8/ir/conversion/NodeExtractionTest.java
@@ -12,9 +12,8 @@
 import com.android.tools.r8.ir.conversion.CallGraphBuilderBase.CycleEliminator;
 import com.android.tools.r8.utils.InternalOptions;
 import com.google.common.collect.Sets;
-import java.util.ArrayList;
-import java.util.List;
 import java.util.Set;
+import java.util.TreeSet;
 import org.junit.Test;
 
 public class NodeExtractionTest extends CallGraphTestBase {
@@ -27,7 +26,7 @@
   @Test
   public void testExtractLeaves_withoutCycle() {
     Node n1, n2, n3, n4, n5, n6;
-    List<Node> nodes;
+    Set<Node> nodes;
 
     n1 = createNode("n1");
     n2 = createNode("n2");
@@ -42,7 +41,7 @@
     n4.addCallerConcurrently(n5);
     n6.addCallerConcurrently(n5);
 
-    nodes = new ArrayList<>();
+    nodes = new TreeSet<>();
     nodes.add(n1);
     nodes.add(n2);
     nodes.add(n3);
@@ -74,7 +73,7 @@
   @Test
   public void testExtractLeaves_withCycle() {
     Node n1, n2, n3, n4, n5, n6;
-    List<Node> nodes;
+    Set<Node> nodes;
 
     n1 = createNode("n1");
     n2 = createNode("n2");
@@ -89,7 +88,7 @@
     n4.addCallerConcurrently(n5);
     n6.addCallerConcurrently(n5);
 
-    nodes = new ArrayList<>();
+    nodes = new TreeSet<>();
     nodes.add(n1);
     nodes.add(n2);
     nodes.add(n3);
@@ -126,7 +125,7 @@
   @Test
   public void testExtractRoots_withoutCycle() {
     Node n1, n2, n3, n4, n5, n6;
-    List<Node> nodes;
+    Set<Node> nodes;
 
     n1 = createNode("n1");
     n2 = createNode("n2");
@@ -141,7 +140,7 @@
     n4.addCallerConcurrently(n5);
     n6.addCallerConcurrently(n5);
 
-    nodes = new ArrayList<>();
+    nodes = new TreeSet<>();
     nodes.add(n1);
     nodes.add(n2);
     nodes.add(n3);
@@ -173,7 +172,7 @@
   @Test
   public void testExtractRoots_withCycle() {
     Node n1, n2, n3, n4, n5, n6;
-    List<Node> nodes;
+    Set<Node> nodes;
 
     n1 = createNode("n1");
     n2 = createNode("n2");
@@ -188,7 +187,7 @@
     n4.addCallerConcurrently(n5);
     n6.addCallerConcurrently(n5);
 
-    nodes = new ArrayList<>();
+    nodes = new TreeSet<>();
     nodes.add(n1);
     nodes.add(n2);
     nodes.add(n3);