且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何从java HashMap获取不可变集合?

更新时间:2022-06-22 03:53:36

它不可能做到这一点与一个单一的API调用, 。在对原始文件进行更改时,不会更改克隆。此主题已在SO之前讨论过,请参见如何克隆ArrayList并克隆其内容吗?深层克隆实用程序建议

Its not possible to do this with a single API call, you need to utilize deep cloning. Clones won't be changed when you make changes to the original. This topic has been discussed on SO before, see How to clone ArrayList and also clone its contents? and Deep clone utility recomendation.