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

Method subSet

corpus/java/training/guava/collect/Sets.java:1758–1782  ·  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

1756 * @since 20.0
1757 */
1758 @Beta
1759 @GwtIncompatible // NavigableSet
1760 public static <K extends Comparable<? super K>> NavigableSet<K> subSet(
1761 NavigableSet<K> set, Range<K> range) {
1762 if (set.comparator() != null
1763 && set.comparator() != Ordering.natural()
1764 && range.hasLowerBound()
1765 && range.hasUpperBound()) {
1766 checkArgument(
1767 set.comparator().compare(range.lowerEndpoint(), range.upperEndpoint()) <= 0,
1768 "set is using a custom comparator which is inconsistent with the natural ordering.");
1769 }
1770 if (range.hasLowerBound() && range.hasUpperBound()) {
1771 return set.subSet(
1772 range.lowerEndpoint(),
1773 range.lowerBoundType() == BoundType.CLOSED,
1774 range.upperEndpoint(),
1775 range.upperBoundType() == BoundType.CLOSED);
1776 } else if (range.hasLowerBound()) {
1777 return set.tailSet(range.lowerEndpoint(), range.lowerBoundType() == BoundType.CLOSED);
1778 } else if (range.hasUpperBound()) {
1779 return set.headSet(range.upperEndpoint(), range.upperBoundType() == BoundType.CLOSED);
1780 }
1781 return checkNotNull(set);
1782 }
1783}

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