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

Method safeRemove

output/java_guava/1.4.18/Maps.java:3557–3566  ·  view source on GitHub ↗

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

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

Source from the content-addressed store, hash-verified

3555
3556
3557 static <V> V safeRemove(Map<?, V> map, Object key) {
3558 checkNotNull(map);
3559 try {
3560 return map.remove(key);
3561 } catch (ClassCastException e) {
3562 return null;
3563 } catch (NullPointerException e) {
3564 return null;
3565 }
3566 }
3567
3568 /**
3569 * An admittedly inefficient implementation of {@link Map#containsKey}.

Callers 3

removeMethod · 0.95
removeMethod · 0.95
removeValuesForKeyMethod · 0.95

Calls 2

removeMethod · 0.65
checkNotNullMethod · 0.45

Tested by

no test coverage detected