LongRangeSet (@NotNull LongRangeSet other) { if (other.isEmpty()) return this; if (other == this) return Empty.EMPTY; long[] result = new long[myRanges.length + other.asRangeArray().length]; int index = 0; for (int i = 0; i < myRanges.length; i += 2) { LongRangeSet res = range(myRanges[i], myRanges[i + 1]).subtract(other); long[] ranges = res.asRangeArray(); System.arraycopy(ranges, 0, result, index, ranges.length); index += ranges.length; } return fromRanges(result, index); }