Is there java utility that does clone() method for HashMap such that it does copy of the map elements not just the map object (as the clone() in HashMap class)?
Is there java utility that does clone() method for HashMap such that it does
Share
What about other objects referred to in the elements? How deep do you want your clone?
If your map elements don’t have any deep references and/or everything is
Serializable, you can serialize the map viaObjectOutputStreaminto aByteArrayOutputStreamand then deserialize it right away.The only other alternative is to do it manually.