void (@NotNull Node<K> oldn, Node<K> newn) { Node<K> parent = oldn.getParent(); if (parent == null) { root = newn; } else { if (oldn == parent.getLeft()) { parent.setLeft(newn); } else { parent.setRight(newn); } } if (newn != null) { newn.setParent(parent); } //oldn.parent = null; //oldn.left = null; //oldn.right = null; }