How to bind entrySet to table in internals of HashMap?

According to the HashMapdoc on entrySet():

public Set> entrySet ()

Added to API level 1 Returns a set containing all the mappings in this map. Each mapping is an instance of Map.Entry. Since many are backed by this map, changes in one will be reflected in the other.

Returns a set of mappings.

But when I check the code HashMap, I can not understand how the field entrySetis associated with tableor any other object.
I am trying to understand how it is entrySetupdated when a method is called put().

+4
source share
2

EntrySet:

 965    final   EntrySet   extends AbstractSet < Map. Entry < K, V >> {
966 public Iterator < Map. Entry < K, V >> iterator() {
967 return newEntryIterator(); < br/ "> 968}
969 public boolean (Object o) {
970 if (! (o instanceof Map Entry))
971 return false;
972 Map Entry < K, V> e = (Map. Entry < K, V>) o;
973 Entry < K, V> = getEntry (e. getKey());
return != null && & && & . equals (e );
975}
976 public boolean (Object o) {
977 return removeMapping (o)!= null;
978}
979 public int size() {
980 return size;
981}
982 public void clear() {
983 HashMap. this clear();
984}
985}

, HashMap. , HashMap.

+1

EntrySet - HashMap, . .

+1

Source: https://habr.com/ru/post/1531518/


All Articles