MCPcopy
hub / github.com/google/guava / unmodifiableEntry

Method unmodifiableEntry

guava/src/com/google/common/collect/Maps.java:1479–1495  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

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(

Callers 4

nextMethod · 0.95
unmodifiableOrNullMethod · 0.95
containsEntryImplMethod · 0.95
removeEntryImplMethod · 0.95

Calls 1

checkNotNullMethod · 0.45

Tested by

no test coverage detected