Returns an unmodifiable view of the specified map entry. The {@link Entry#setValue} operation throws an {@link UnsupportedOperationException}. This also has the side effect of redefining {@code equals} to comply with the Entry contract, to avoid a possible nefarious implementation of equals. @param
(
Entry<? extends K, ? extends V> entry)
| 1477 | * @return an unmodifiable view of the entry |
| 1478 | */ |
| 1479 | static <K extends @Nullable Object, V extends @Nullable Object> Entry<K, V> unmodifiableEntry( |
| 1480 | Entry<? extends K, ? extends V> entry) { |
| 1481 | checkNotNull(entry); |
| 1482 | return new AbstractMapEntry<K, V>() { |
| 1483 | @Override |
| 1484 | @ParametricNullness |
| 1485 | public K getKey() { |
| 1486 | return entry.getKey(); |
| 1487 | } |
| 1488 | |
| 1489 | @Override |
| 1490 | @ParametricNullness |
| 1491 | public V getValue() { |
| 1492 | return entry.getValue(); |
| 1493 | } |
| 1494 | }; |
| 1495 | } |
| 1496 | |
| 1497 | static <K extends @Nullable Object, V extends @Nullable Object> |
| 1498 | UnmodifiableIterator<Entry<K, V>> unmodifiableEntryIterator( |
no test coverage detected