String user = userAndFriends[0];
String[] friends = userAndFriends[1].split(",");
v.set(user);
for (String f : friends) {
k.set(f);
context.write(k, v);
}
}
}
public static class CommonFriendsOneReducer extends Reducer<Text, Text, Text, Text>{
// 一组数据: B --> A E F J .....
// 一组数据: C --> B F E J .....
@Override
protected void reduce(Text friend, Iterable<Text> users, Reducer<Text, Text, Text, Text>.Context context)
throws IOException, InterruptedException {