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

Method safeRemove

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

3559
3560
3561 static <V> V safeRemove(Map<?, V> map, Object key) {
3562 checkNotNull(map);
3563 try {
3564 return map.remove(key);
3565 } catch (ClassCastException e) {
3566 return null;
3567 } catch (NullPointerException e) {
3568 return null;
3569 }
3570 }
3571
3572 /**
3573 * 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