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