I’m trying to translate the following Python code to Java:
graph = {'A': set(['S', 'B']),
'B': set(['A'])}
What’s the most elegant way to do it using modern Java? I know I can construct a Hashmap<Character, HashSet<Character>>
and use the put
method.