Skip to content
Original file line number Diff line number Diff line change
Expand Up @@ -46,14 +46,11 @@ public final <K, V> JavaPairRDD<K, V> union(JavaPairRDD<K, V>... rdds) {
if (rdds.length == 0) {
throw new IllegalArgumentException("Union called on empty list");
}
List<JavaPairRDD<K, V>> rest = new ArrayList<>(rdds.length - 1);
for (int i = 1; i < rdds.length; i++) {
rest.add(rdds[i]);
}
rest = populateRDDList(rdds);
return union(rdds[0], rest);
}

public final List<T> populateRDDList(T rdds) {
public static final List<T> populateRDDList(T rdds) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One last thing -- private? And doesn't this have to be T... rdds to work?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree with making the method "private".But rdds is not any varargs so why do we need ...??

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This doesn't build. You're using T like an array type but it isn't. It has to be an array type as far as the method is concerned. T[] would be fine as the type.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I created a build with T...

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

will this work ??

List<T> rest = new ArrayList<>(rdds.length - 1);
for (int i = 1; i < rdds.length; i++) {
rest.add(rdds[i]);
Expand Down