MCPcopy Create free account
hub / github.com/antlr/codebuff / subSet

Method subSet

output/java_guava/1.4.18/Sets.java:1809–1827  ·  view source on GitHub ↗

Returns a view of the portion of set whose elements are contained by range. This method delegates to the appropriate methods of NavigableSet (namely NavigableSet#subSet(Object, boolean, Object, boolean) subSet(), {@link NavigableSet#tailSet(Object, boolean) tailSe

(NavigableSet<K> set, Range<K> range)

Source from the content-addressed store, hash-verified

1807 */
1808
1809 @Beta
1810 @GwtIncompatible // NavigableSet
1811 public static <K extends Comparable<? super K>> NavigableSet<K> subSet(NavigableSet<K> set, Range<K> range) {
1812 if (set.comparator() != null && set.comparator() != Ordering.natural()
1813 && range.hasLowerBound()
1814 && range.hasUpperBound()) {
1815 checkArgument(set.comparator().compare(range.lowerEndpoint(), range.upperEndpoint()) <= 0, "set is using a custom comparator which is inconsistent with the natural ordering.");
1816 }
1817 if (range.hasLowerBound() && range.hasUpperBound()) {
1818 return set.subSet(
1819 range.lowerEndpoint(), range.lowerBoundType() == BoundType.CLOSED,
1820 range.upperEndpoint(), range.upperBoundType() == BoundType.CLOSED);
1821 } else if (range.hasLowerBound()) {
1822 return set.tailSet(range.lowerEndpoint(), range.lowerBoundType() == BoundType.CLOSED);
1823 } else if (range.hasUpperBound()) {
1824 return set.headSet(range.upperEndpoint(), range.upperBoundType() == BoundType.CLOSED);
1825 }
1826 return checkNotNull(set);
1827 }
1828}

Callers 4

subSetMethod · 0.45
subSetMethod · 0.45
subSetMethod · 0.45
subSetMethod · 0.45

Calls 13

naturalMethod · 0.95
comparatorMethod · 0.65
hasLowerBoundMethod · 0.45
hasUpperBoundMethod · 0.45
checkArgumentMethod · 0.45
compareMethod · 0.45
lowerEndpointMethod · 0.45
upperEndpointMethod · 0.45
lowerBoundTypeMethod · 0.45
upperBoundTypeMethod · 0.45
tailSetMethod · 0.45
headSetMethod · 0.45

Tested by

no test coverage detected