Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- JavaPairRDD<String,List<String>> combination= keyValue.flatMapToPair(new PairFlatMapFunction<Tuple2<String,List<String>>, String, List<String>>() {
- @Override
- public Iterable<Tuple2<String, List<String>>> call(Tuple2<String, List<String>> stringListTuple2) throws Exception {
- Collection<Tuple2<String,List<String>>> coll = new ArrayList<>();
- keyValue.foreach(k->{
- String key=stringListTuple2._1();
- key+=k._1();
- List<String> res= (List<String>) CollectionUtils.intersection(k._2(),stringListTuple2._2());
- coll.add(new Tuple2<String,List<String>>(key,res));
- });
- return coll;
- }
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement