A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/util/Map.Entry.html below:

Map.Entry (Java SE 17 & JDK 17)

All Known Implementing Classes:
AbstractMap.SimpleEntry, AbstractMap.SimpleImmutableEntry
Enclosing interface:
Map<K,V>

public static interface Map.Entry<K,V>

A map entry (key-value pair). The Entry may be unmodifiable, or the value may be modifiable if the optional

setValue

method is implemented. The Entry may be independent of any map, or it may represent an entry of the entry-set view of a map.

Instances of the Map.Entry interface may be obtained by iterating the entry-set view of a map. These instances maintain a connection to the original, backing map. This connection to the backing map is valid only for the duration of iteration over the entry-set view. During iteration of the entry-set view, if supported by the backing map, a change to a Map.Entry's value via the setValue method will be visible in the backing map. The behavior of such a Map.Entry instance is undefined outside of iteration of the map's entry-set view. It is also undefined if the backing map has been modified after the Map.Entry was returned by the iterator, except through the Map.Entry.setValue method. In particular, a change to the value of a mapping in the backing map might or might not be visible in the corresponding Map.Entry element of the entry-set view.

API Note:
It is possible to create a Map.Entry instance that is disconnected from a backing map by using the copyOf method. For example, the following creates a snapshot of a map's entries that is guaranteed not to change even if the original map is modified:
 
 var entries = map.entrySet().stream().map(Map.Entry::copyOf).toList()
 
Since:
1.2
See Also:

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4