See {@link #removeMutationsInRange(int, int)}.

<p>Ranges must be sorted.</p>

@param ranges ranges to remove
439788
public Mutations<S> removeMutationsInRanges(Range... ranges) {
        Mutations<S> result = this;
        int offset = 0;
        int lastTo = 0;
        for (Range range : ranges) {
            if (range.getFrom() < lastTo)
                throw new IllegalArgumentException("Ranges are not sorted.");
            result = result.removeMutationsInRange(range.move(offset));
            offset -= range.length();
            lastTo = range.getTo();
        }
        return result;
    }
632945
public MultiChangeBuilder<PS, SEG, S> deleteText(IndexRange range) {
        return deleteText(range.getStart(), range.getEnd());
    }
1008350
function(ranges) {
      let unstaggeredRanges = [];
      ranges.forEach(function(range) {
        let isStaggered = unstaggeredRanges.some(function(unstaggeredRange) {
          let isStartInside =
            range[0] > unstaggeredRange[0] && range[0] < unstaggeredRange[1];
          let isStopInside =
            range[1] > unstaggeredRange[0] && range[1] < unstaggeredRange[1];
          return isStartInside !== isStopInside; // xor
        });
        if (!isStaggered) {
          unstaggeredRanges.push(range);
        }
      });
      return unstaggeredRanges;
    }
340648
public static boolean removeMergedRange(final Sheet sheet, final CellRangeAddress mergedRange) {
        ArgUtils.notNull(sheet, "sheet");
        ArgUtils.notNull(mergedRange, "mergedRange");

        final String mergedAddress = mergedRange.formatAsString(sheet.getSheetName(), true);

        final int num = sheet.getNumMergedRegions();
        for(int i=0; i < num; i ++) {
            final CellRangeAddress range = sheet.getMergedRegion(i);
            final String rangeAddress = range.formatAsString(sheet.getSheetName(), true);
            if(rangeAddress.equals(mergedAddress)) {
                sheet.removeMergedRegion(i);
                return true;
            }
        }

        return false;
    }
595506
public static <T extends Comparable<T>> RangeSet<T> intersectRangeSets(final Iterable<RangeSet<T>> rangeSets)
  {
    RangeSet<T> rangeSet = null;
    for (final RangeSet<T> set : rangeSets) {
      if (rangeSet == null) {
        rangeSet = TreeRangeSet.create();
        rangeSet.addAll(set);
      } else {
        rangeSet.removeAll(set.complement());
      }
    }
    return rangeSet;
  }
1226491
private void processRanges(List<DateRange> ranges, ProjectCalendarDateRanges container)
   {
      if (ranges != null)
      {
         for (DateRange range : ranges)
         {
            container.addRange(range);
         }
      }
   }
320269
@Override
    public Table removeColumns(Column<?>... columns) {
        columnList.removeAll(Arrays.asList(columns));
        return this;
    }
327926
public static List<Long> starts(final Iterable<Range<Long>> ranges) {
        List<Long> starts = new ArrayList<Long>();
        for (Range<Long> range : ranges) {
            checkClosedOpen(range);
            starts.add(range.lowerEndpoint());
        }
        return starts;
    }
1276915
private static <T extends RingPosition<T>> List<Range<T>> deoverlap(List<Range<T>> ranges)
    {
        if (ranges.isEmpty())
            return ranges;

        List<Range<T>> output = new ArrayList<Range<T>>();

        Iterator<Range<T>> iter = ranges.iterator();
        Range<T> current = iter.next();

        @SuppressWarnings("unchecked")
        T min = (T) current.partitioner.minValue(current.left.getClass());
        while (iter.hasNext())
        {
            // If current goes to the end of the ring, we're done
            if (current.right.equals(min))
            {
                // If one range is the full range, we return only that
                if (current.left.equals(min))
                    return Collections.<Range<T>>singletonList(current);

                output.add(new Range<T>(current.left, min));
                return output;
            }

            Range<T> next = iter.next();

            // if next left is equal to current right, we do not intersect per se, but replacing (A, B] and (B, C] by (A, C] is
            // legit, and since this avoid special casing and will result in more "optimal" ranges, we do the transformation
            if (next.left.compareTo(current.right) <= 0)
            {
                // We do overlap
                // (we've handled current.right.equals(min) already)
                if (next.right.equals(min) || current.right.compareTo(next.right) < 0)
                    current = new Range<T>(current.left, next.right);
            }
            else
            {
                output.add(current);
                current = next;
            }
        }
        output.add(current);
        return output;
    }
1043163
@SuppressWarnings("unchecked")
    public List<Range> without(Range range) {
        if (!intersectsWith(range))
            return Collections.singletonList(this);

        if (upper <= range.upper)
            return range.lower <= lower ? Collections.EMPTY_LIST : Collections.singletonList(new Range(lower, range.lower, reversed));

        if (range.lower <= lower)
            return Collections.singletonList(new Range(range.upper, upper, reversed));

        return Arrays.asList(new Range(lower, range.lower, reversed), new Range(range.upper, upper, reversed));
    }
253834
public void remove(final long rangeStart, final long rangeEnd) {
    rangeSanityCheck(rangeStart, rangeEnd);
    if (rangeStart >= rangeEnd) {
      return; // empty range
    }
    final int hbStart = BufferUtil.toIntUnsigned(BufferUtil.highbits(rangeStart));
    final int lbStart = BufferUtil.toIntUnsigned(BufferUtil.lowbits(rangeStart));
    final int hbLast = BufferUtil.toIntUnsigned(BufferUtil.highbits(rangeEnd - 1));
    final int lbLast = BufferUtil.toIntUnsigned(BufferUtil.lowbits(rangeEnd - 1));
    if (hbStart == hbLast) {
      final int i = highLowContainer.getIndex((short) hbStart);
      if (i < 0) {
        return;
      }
      final MappeableContainer c =
          highLowContainer.getContainerAtIndex(i).iremove(lbStart, lbLast + 1);
      if (!c.isEmpty()) {
        ((MutableRoaringArray) highLowContainer).setContainerAtIndex(i, c);
      } else {
        ((MutableRoaringArray) highLowContainer).removeAtIndex(i);
      }
      return;
    }
    int ifirst = highLowContainer.getIndex((short) hbStart);
    int ilast = highLowContainer.getIndex((short) hbLast);
    if (ifirst >= 0) {
      if (lbStart != 0) {
        final MappeableContainer c = highLowContainer.getContainerAtIndex(ifirst).iremove(lbStart,
            BufferUtil.maxLowBitAsInteger() + 1);
        if (!c.isEmpty()) {
          ((MutableRoaringArray) highLowContainer).setContainerAtIndex(ifirst, c);
          ifirst++;
        }
      }
    } else {
      ifirst = -ifirst - 1;
    }
    if (ilast >= 0) {
      if (lbLast != BufferUtil.maxLowBitAsInteger()) {
        final MappeableContainer c =
            highLowContainer.getContainerAtIndex(ilast).iremove(0, lbLast + 1);
        if (!c.isEmpty()) {
          ((MutableRoaringArray) highLowContainer).setContainerAtIndex(ilast, c);
        } else {
          ilast++;
        }
      } else {
        ilast++;
      }
    } else {
      ilast = -ilast - 1;
    }
    ((MutableRoaringArray) highLowContainer).removeIndexRange(ifirst, ilast);
  }
788251
public static RangeSet split(Collection<RangeSet> rangeSets)
    {
        RangeSet result = new RangeSet();
        SortedSet<Integer> ss = new TreeSet<Integer>();
        for (RangeSet rs : rangeSets)
        {
            for (CharRange r : rs)
            {
                ss.add(r.getFrom());
                ss.add(r.getTo());
            }
        }
        Iterator<Integer> i = ss.iterator();
        if (i.hasNext())
        {
            int from = i.next();
            while (i.hasNext())
            {
                int to = i.next();
                if (from != to)
                {
                    for (RangeSet rs : rangeSets)
                    {
                        if (rs.contains(from, to))
                        {
                            result.add(from, to);
                            break;
                        }
                    }
                }
                from = to;
            }
        }
        return result;
    }
24875
public final void removeEntries(Iterator<Entry<?>> entries) {
        if (entries != null) {
            while (entries.hasNext()) {
                removeEntry(entries.next());
            }
        }
    }
6580
public static <T extends Comparable<T>> RangeSet<T> unionRanges(final Iterable<Range<T>> ranges)
  {
    RangeSet<T> rangeSet = null;
    for (Range<T> range : ranges) {
      if (rangeSet == null) {
        rangeSet = TreeRangeSet.create();
      }
      rangeSet.add(range);
    }
    return rangeSet;
  }
387416
function combineRanges (ranges) {
  var ordered = ranges.map(mapWithIndex).sort(sortByRangeStart)

  for (var j = 0, i = 1; i < ordered.length; i++) {
    var range = ordered[i]
    var current = ordered[j]

    if (range.start > current.end + 1) {
      // next range
      ordered[++j] = range
    } else if (range.end > current.end) {
      // extend range
      current.end = range.end
      current.index = Math.min(current.index, range.index)
    }
  }

  // trim ordered array
  ordered.length = j + 1

  // generate combined range
  var combined = ordered.sort(sortByRangeIndex).map(mapWithoutIndex)

  // copy ranges type
  combined.type = ranges.type

  return combined
}
425021
public static boolean inRange(Range range, double val) {
        return val >= range.min() && val <= range.max();
    }
489975
public static boolean[] updateRanges(boolean[] range, GrammarRules grammar) {
    boolean[] res = Arrays.copyOf(range, range.length);
    for (GrammarRuleRecord r : grammar) {
      if (0 == r.getRuleNumber()) {
        continue;
      }
      res = updateRanges(res, r.getRuleIntervals());
    }
    return res;
  }