[Solved] What type of object is returned when keySet() method of HashMap is called in java? [closed]


According to java doc,

Map.keyset() Returns a set view of the keys contained in this map. The
set is backed by the map, so changes to the map are reflected in the
set, and vice-versa. If the map is modified while an iteration over
the set is in progress (except through the iterator’s own remove
operation), the results of the iteration are undefined.

so basically it is an object of a class which implements Set Interface that’s why we are able to call iterator() on that object.

0

solved What type of object is returned when keySet() method of HashMap is called in java? [closed]