MCPcopy Index your code
hub / github.com/antlr/codebuff / safeGet

Method safeGet

output/java_guava/1.4.17/Maps.java:3523–3532  ·  view source on GitHub ↗

Delegates to Map#get. Returns null on ClassCastException and NullPointerException.

(Map<?, V> map, @Nullable Object key)

Source from the content-addressed store, hash-verified

3521
3522
3523 static <V> V safeGet(Map<?, V> map, @Nullable Object key) {
3524 checkNotNull(map);
3525 try {
3526 return map.get(key);
3527 } catch (ClassCastException e) {
3528 return null;
3529 } catch (NullPointerException e) {
3530 return null;
3531 }
3532 }
3533
3534 /**
3535 * Delegates to {@link Map#containsKey}. Returns {@code false} on {@code

Callers 15

countMethod · 0.95
addMethod · 0.95
removeMethod · 0.95
removeExactlyMethod · 0.95
setCountMethod · 0.95
containsMethod · 0.95
countMethod · 0.95
getMethod · 0.95
countMethod · 0.95
removeMethod · 0.95
containsMethod · 0.95
getMethod · 0.95

Calls 2

getMethod · 0.65
checkNotNullMethod · 0.45

Tested by

no test coverage detected