LongRangeSet (@NotNull LongRangeSet other) { if (!(other instanceof RangeSet)) { return other.join(this); } if(other == this) return this; if(other.contains(this)) return other; if(this.contains(other)) return this; LongRangeSet result = other; for(int i=0; i<myRanges.length; i+=2) { result = range(myRanges[i], myRanges[i+1]).join(result); } return result; }