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

Method subMap

output/java_guava/1.4.19/Maps.java:4232–4252  ·  view source on GitHub ↗

Returns a view of the portion of map whose keys are contained by range. This method delegates to the appropriate methods of NavigableMap (namely NavigableMap#subMap(Object, boolean, Object, boolean) subMap(), NavigableMap#tailMap(Object, boolean) tailMap()

(NavigableMap<K, V> map, Range<K> range)

Source from the content-addressed store, hash-verified

4230 */
4231
4232 @Beta
4233 @GwtIncompatible // NavigableMap
4234 public static <K extends Comparable<? super K>, V> NavigableMap<K, V> subMap(NavigableMap<K, V> map, Range<K> range) {
4235 if (map.comparator() != null && map.comparator() != Ordering.natural()
4236 && range.hasLowerBound()
4237 && range.hasUpperBound()) {
4238 checkArgument(map.comparator().compare(range.lowerEndpoint(), range.upperEndpoint()) <= 0, "map is using a custom comparator which is inconsistent with the natural ordering.");
4239 }
4240 if (range.hasLowerBound() && range.hasUpperBound()) {
4241 return map.subMap(
4242 range.lowerEndpoint(),
4243 range.lowerBoundType() == BoundType.CLOSED,
4244 range.upperEndpoint(),
4245 range.upperBoundType() == BoundType.CLOSED);
4246 } else if (range.hasLowerBound()) {
4247 return map.tailMap(range.lowerEndpoint(), range.lowerBoundType() == BoundType.CLOSED);
4248 } else if (range.hasUpperBound()) {
4249 return map.headMap(range.upperEndpoint(), range.upperBoundType() == BoundType.CLOSED);
4250 }
4251 return checkNotNull(map);
4252 }
4253}

Callers 10

subMapMethod · 0.45
subMapMethod · 0.45
subSetMethod · 0.45
subMapMethod · 0.45
subMapMethod · 0.45
subMapMethod · 0.45
subSetMethod · 0.45
subSetMethod · 0.45
subMapMethod · 0.45
removeMethod · 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
tailMapMethod · 0.45
headMapMethod · 0.45

Tested by

no test coverage detected