void () { myHeaps = new HashMap<>(); for (Node node : mySortedNodes) { myProgressIndicator.checkCanceled(); HeapNode<Node> outRoot = myOutRoots.get(node); Node next = myNextNodes.get(node); if (outRoot == null) { if (next != null) { myHeaps.put(node, myHeaps.get(next)); } continue; } final Heap<Node> nextHeap = myHeaps.get(next); if (nextHeap == null) { myHeaps.put(node, new Heap<>(outRoot)); continue; } final Heap<Node> tHeap = nextHeap.insert(outRoot); myHeaps.put(node, tHeap); } }