File tree Expand file tree Collapse file tree 1 file changed +7
-10
lines changed Expand file tree Collapse file tree 1 file changed +7
-10
lines changed Original file line number Diff line number Diff line change @@ -212,7 +212,9 @@ private static Collection<Node> union(Collection<Node> xs, Node y) {
212212 return xs ;
213213 }
214214
215- return nonNullUnion (xs , Collections .singleton (y ));
215+ List <Node > result = new ArrayList <>(xs );
216+ result .add (y );
217+ return result ;
216218 }
217219
218220 private static Collection <Node > union (Node x , Collection <Node > ys ) {
@@ -226,7 +228,10 @@ private static Collection<Node> union(Node x, Collection<Node> ys) {
226228 return ys ;
227229 }
228230
229- return nonNullUnion (Collections .singleton (x ), ys );
231+ List <Node > result = new ArrayList <>();
232+ result .add (x );
233+ result .addAll (ys );
234+ return result ;
230235 }
231236
232237 /**
@@ -240,14 +245,6 @@ private static Collection<Node> union(Collection<Node> xs, Collection<Node> ys)
240245 return xs ;
241246 }
242247
243- return nonNullUnion (xs , ys );
244- }
245-
246- /**
247- * Creates an order preserving concatenation of the nodes in `xs` and `ys` without duplicates.
248- * Where `xs` and `ys` have non null values, and are non-empty.
249- */
250- private static Collection <Node > nonNullUnion (Collection <Node > xs , Collection <Node > ys ) {
251248 List <Node > result = new ArrayList <>(xs );
252249 for (Node y : ys ) {
253250 if (!result .contains (y )) {
You can’t perform that action at this time.
0 commit comments