Sorry. Here is my code: Set nodes = new HashSet(); Map> edges = new HashMap>(); public void addEdge(int p1, MethodNode m1, ClassNode c1, int p2, MethodNode m2, ClassNode c2) { Node n1 = new Node(p1,m1,c1); Node n2 = new Node(p2,m2,c2); nodes.add(n1); nodes.add(n2); edges.put(n1,nodes); My aim is to fetch the value of key n2 and add it to n1. but ...