boolean (ActionChangeRange @NotNull [] ranges, int i) { ActionChangeRange first = ranges[i]; ActionChangeRange second = ranges[i + 1]; if (first.moveAfter(second, true)) { if (second.moveAfter(first.asInverted(), false)) { ranges[i + 1] = first; ranges[i] = second; return true; } } return false; }