Node (Node node) { if (node.myAnchor == null) return this; if (node instanceof Switch && node.myAnchor == myAnchor) { if (myReturns.isEmpty()) return node; if (((Switch)node).myReturns.isEmpty()) return this; Map<PsiStatement, Node> newMap = new HashMap<>(myReturns); ((Switch)node).myReturns.forEach((statement, n) -> newMap.merge(statement, n, Node::prepend)); return new Switch((PsiSwitchExpression)myAnchor, newMap); } return new Cons(node, this); }