void (@Nullable IntervalNode<T> root, int start, int end, @NotNull List<? super IntervalNode<T>> affected) { if (root == null) return; pushDelta(root); int maxEnd = root.maxEnd; assert root.isValid(); if (start > maxEnd) { // no need to bother return; } collectNodesToRetarget(root.getLeft(), start, end, affected); if (start <= root.intervalStart() && root.intervalEnd() <= end) { affected.add(root); } if (end < root.intervalStart()) { return; } collectNodesToRetarget(root.getRight(), start, end, affected); }