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) {
212
212
return xs ;
213
213
}
214
214
215
- return nonNullUnion (xs , Collections .singleton (y ));
215
+ List <Node > result = new ArrayList <>(xs );
216
+ result .add (y );
217
+ return result ;
216
218
}
217
219
218
220
private static Collection <Node > union (Node x , Collection <Node > ys ) {
@@ -226,7 +228,10 @@ private static Collection<Node> union(Node x, Collection<Node> ys) {
226
228
return ys ;
227
229
}
228
230
229
- return nonNullUnion (Collections .singleton (x ), ys );
231
+ List <Node > result = new ArrayList <>();
232
+ result .add (x );
233
+ result .addAll (ys );
234
+ return result ;
230
235
}
231
236
232
237
/**
@@ -240,14 +245,6 @@ private static Collection<Node> union(Collection<Node> xs, Collection<Node> ys)
240
245
return xs ;
241
246
}
242
247
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 ) {
251
248
List <Node > result = new ArrayList <>(xs );
252
249
for (Node y : ys ) {
253
250
if (!result .contains (y )) {
You can’t perform that action at this time.
0 commit comments