code: public IndexRange mergedWith(final IndexRange other)
      {
          Objects.requireNonNull(other, "other");
          return new IndexRange(Math.min(start, other.start),
              Math.max(end, other.end));
      }
docs: Created a new IndexRange that spans all characters between the smallest and the highest index of the two ranges.
  
  @param other the other range
  @return a new IndexRange instance