diff options
author | Patrick Wendell <pwendell@gmail.com> | 2013-02-11 10:45:45 -0800 |
---|---|---|
committer | Patrick Wendell <pwendell@gmail.com> | 2013-02-11 10:45:45 -0800 |
commit | d09c36065ca040044530a50f0392c92866b6d301 (patch) | |
tree | 59bbf9f0cc76dc2462419577377f0d7cc999fa17 /streaming/src | |
parent | 04786d07391c4052d6dc42ff0828a79a37bbbfdf (diff) | |
download | spark-d09c36065ca040044530a50f0392c92866b6d301.tar.gz spark-d09c36065ca040044530a50f0392c92866b6d301.tar.bz2 spark-d09c36065ca040044530a50f0392c92866b6d301.zip |
Using tuple swap()
Diffstat (limited to 'streaming/src')
-rw-r--r-- | streaming/src/test/java/spark/streaming/JavaAPISuite.java | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/streaming/src/test/java/spark/streaming/JavaAPISuite.java b/streaming/src/test/java/spark/streaming/JavaAPISuite.java index 551d4f15e4..9bfcd83e4d 100644 --- a/streaming/src/test/java/spark/streaming/JavaAPISuite.java +++ b/streaming/src/test/java/spark/streaming/JavaAPISuite.java @@ -528,7 +528,7 @@ public class JavaAPISuite implements Serializable { new PairFunction<Tuple2<String, Integer>, Integer, String>() { @Override public Tuple2<Integer, String> call(Tuple2<String, Integer> in) throws Exception { - return new Tuple2(in._2(), in._1()); + return in.swap(); } }); @@ -563,7 +563,7 @@ public class JavaAPISuite implements Serializable { LinkedList<Tuple2<Integer, String>> out = new LinkedList<Tuple2<Integer, String>>(); while (in.hasNext()) { Tuple2<String, Integer> next = in.next(); - out.add(new Tuple2<Integer, String>(next._2(), next._1())); + out.add(next.swap()); } return out; } |