Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Difference between Map and Map.Entry<K,V> interface

Tags:

java

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?

like image 343
Anands23 Avatar asked Oct 18 '22 03:10

Anands23


1 Answers

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

like image 97
SamTebbs33 Avatar answered Oct 30 '22 16:10

SamTebbs33