ObjectNode (@NotNull Disposable nodeToDelete) { List<ObjectNode> children = myChildren; // optimization: iterate backwards for (int i = children.size() - 1; i >= 0; i--) { ObjectNode node = children.get(i); if (node.getObject() == nodeToDelete) { return children.remove(i); } } return null; }