Skip to content
Advertisement

Difference between Map and Map.Entry interface

What is the difference(if any) between Map and Map.Entry<K,V> interface and what is the purpose of Map.Entry<K,V> interface?

Advertisement

Answer

The Map interface describes a data structure that stores key-value entries. The Map.Entry interface describes the structure of these entries, stores and provides a way of retrieving the associated key and value (dependent on implementation).

These interfaces are implemented by concrete classes that implement the functionality described by the interfaces.

Map docs: https://docs.oracle.com/javase/8/docs/api/java/util/Map.html

Map.Entry docs: https://docs.oracle.com/javase/8/docs/api/java/util/Map.Entry.html

User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement