Delegates to Map#remove. Returns null on ClassCastException and NullPointerException.
(Map<?, V> map, Object key)
| 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}. |
no test coverage detected