With the code below I am trying to work out an add statement that will see which person likes programming, which person likes cycling etc. and add their name to the set corresponding to that interest.

E.G. Peter likes Programming, so add the name Peter to the set in interestFans whose key is Programming. Repeat this for all the names in the set allPeople and the all that persons interests in the map personInterests.

With the code below I am trying to work out an add statement that will see which person likes programming, which person likes cycling etc. and add their name to the set corresponding to that interest.

E.G. Peter likes Programming, so add the name Peter to the set in interestFans whose key is Programming. Repeat this for all the names in the set allPeople and the all that persons interests in the map personInterests.

Does this help?

Yep, now I understand; your map has an interest as a key and a Set of persons as its value; this map only allows you to find the Set of persons given an interest key. Why don't you build another map where the persons are the key and their interests are a Set as the corresponding value? Both maps will be a Map<String, Set<String>>.