This HashMap constructor says it creates a new Map with the same mappings. The
clone() method creates a shallow clone (and its return type is Object). You cannot expect a Map or Collection to have a method which creates a deep clone because you cannot predict whether the “K”s and “V”s are mutable or not, and if mutable, how they should be copied. Dave Tolls is right about the difference between changing the Map and changing the state of one of its “V”s.