Tarjan's strongly connected components algorithm
There is no reason to use String as keys in graph. By default an object can be used as a key in a hashmap based on it's uniqueness.

There is no reason that the values have to be ArrayLists instead just use List.

HashMap&lt;Node, List&lt;Node&gt;&gt; graph = new HashMap&lt;&gt;();


This can clean up the init code as you don't have to do new ArrayList&lt;&gt; and can instead just pass Arrays.asList(nodes.get("a")) directly.

Though having said all that you can just put the List of neighbours straight in the Node and not deal with having to look it up in strongConnect.