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

Method safeGet

output/java_guava/1.4.19/Maps.java:3527–3536  ·  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

3525
3526
3527 static <V> V safeGet(Map<?, V> map, @Nullable Object key) {
3528 checkNotNull(map);
3529 try {
3530 return map.get(key);
3531 } catch (ClassCastException e) {
3532 return null;
3533 } catch (NullPointerException e) {
3534 return null;
3535 }
3536 }
3537
3538 /**
3539 * 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