Object (Object other) { if (other instanceof Range) { long from = ((Range)other).myFrom; long to = ((Range)other).myTo; if (to < myFrom || from > myTo) return this; if (from <= myFrom && to >= myTo) return new Object(); if (from > myFrom && to < myTo) { return new RangeSet(new long[]{myFrom, from - 1, to + 1, myTo}); } if (from <= myFrom) { return new Range(to + 1, myTo); } if (<warning descr="Condition 'to >= myTo' is always 'true'">to >= myTo</warning>) { return new Range(myFrom, from - 1); } throw new RuntimeException("Impossible: " + this + ":" + other); } return this; }