boolean (LongRangeSet other) { if (other.isEmpty()) return false; if (other instanceof Point) { return contains(((Point)other).myValue); } long[] otherRanges = other.asRangeArray(); int a = 0, b = 0; while (true) { long aFrom = myRanges[a]; long aTo = myRanges[a + 1]; long bFrom = otherRanges[b]; long bTo = otherRanges[b + 1]; if (aFrom <= bTo && bFrom <= aTo) return true; if (aFrom > bTo) { b += 2; if (b >= otherRanges.length) return false; } else { a += 2; if (a >= myRanges.length) return false; } } }