Package mapreduce.apps.friends.studio
Class MutualFriendsMapper
java.lang.Object
mapreduce.apps.friends.studio.MutualFriendsMapper
public class MutualFriendsMapper
extends Object
implements Mapper<Account,OrderedPair<AccountId>,Set<AccountId>>
A
Mapper for the mutual friends program. Remember the example covered
in the slides. Given a single user, you're creating many key-value pairs. For
each key-value pair, the key is an OrderedPair of the original
account's ID and one of their friends. The values for all of these key-value
pairs are the same: a list of all of the account's friends.
As an example, say you call the map method on account A, who is friends with
B, C, and D. The key-value pairs written by this method would be:
[((A, B), [B, C, D]), ((A, C), [B, C, D]), ((A, D), [B, C, D]))
Review the slides for more information.- Author:
- __STUDENT_NAME__, Finn Voichick, Dennis Cosgrove (http://www.cse.wustl.edu/~cosgroved/)
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidmap(Account account, BiConsumer<OrderedPair<AccountId>,Set<AccountId>> keyValuePairConsumer)Given and account, produces key-value pairs where the key is a pair of account IDs, and each value is a list of all of the original account's friends.
-
Constructor Details
-
MutualFriendsMapper
public MutualFriendsMapper()
-
-
Method Details
-
map
public void map(Account account, BiConsumer<OrderedPair<AccountId>,Set<AccountId>> keyValuePairConsumer)Given and account, produces key-value pairs where the key is a pair of account IDs, and each value is a list of all of the original account's friends.- Specified by:
mapin interfaceMapper<Account,OrderedPair<AccountId>,Set<AccountId>>- See Also:
Account,AccountId,OrderedPair
-