Advertisement
Guest User

Untitled

a guest
Jul 28th, 2017
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.75 KB | None | 0 0
  1. JavaPairRDD<String,List<String>> combination= keyValue.flatMapToPair(new PairFlatMapFunction<Tuple2<String,List<String>>, String, List<String>>() {
  2. @Override
  3. public Iterable<Tuple2<String, List<String>>> call(Tuple2<String, List<String>> stringListTuple2) throws Exception {
  4. Collection<Tuple2<String,List<String>>> coll = new ArrayList<>();
  5. keyValue.foreach(k->{
  6. String key=stringListTuple2._1();
  7. key+=k._1();
  8. List<String> res= (List<String>) CollectionUtils.intersection(k._2(),stringListTuple2._2());
  9. coll.add(new Tuple2<String,List<String>>(key,res));
  10. });
  11. return coll;
  12. }
  13. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement