private static Set<TextRange> filterNested(Set<? extends TextRange> allRanges) {
    Set<TextRange> filtered = new LinkedHashSet<>(allRanges.size());
    for (TextRange outer : allRanges) {
      boolean contains = anyRangeContains(allRanges, outer);
      if (!contains) filtered.add(outer);
    }

    return filtered;
  }
private static Set<TextRange> filterNested(Set<? extends TextRange> allRanges)