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

Method subMap

output/java_guava/1.4.18/Maps.java:4228–4246  ·  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

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

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