LongRangeSet (LongRangeSet other, LongRangeType lrType) { if (other.isEmpty()) return other; if (equals(lrType.fullRange())) return this; if (other instanceof Point || other instanceof Range || (other instanceof RangeSet && ((RangeSet)other).myRanges.length > 6)) { return plus(myFrom, myTo, other.min(), other.max(), lrType); } long[] ranges = other.asRangeArray(); LongRangeSet result = empty(); for (int i = 0; i < ranges.length; i += 2) { result = result.join(plus(myFrom, myTo, ranges[i], ranges[i + 1], lrType)); } return result; }