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

Method safeGet

corpus/java/training/guava/collect/Maps.java:3482–3491  ·  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

3480 * ClassCastException} and {@code NullPointerException}.
3481 */
3482 static <V> V safeGet(Map<?, V> map, @Nullable Object key) {
3483 checkNotNull(map);
3484 try {
3485 return map.get(key);
3486 } catch (ClassCastException e) {
3487 return null;
3488 } catch (NullPointerException e) {
3489 return null;
3490 }
3491 }
3492
3493 /**
3494 * 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