Attention:如果当前key已存在,则会覆盖key在Map当中原来的值。
源码解释展示;
复制代码
1
2
3
4
5
6
7
8/** * Associates the specified value with the specified key in this map * (optional operation). If the map previously contained a mapping for * the key, the old value is replaced by the specified value. (A map * <tt>m</tt> is said to contain a mapping for a key <tt>k</tt> if and only * if {@link #containsKey(Object) m.containsKey(k)} would return * <tt>true</tt>.)
最后
以上就是优雅萝莉最近收集整理的关于Map的put的全部内容,更多相关Map内容请搜索靠谱客的其他文章。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复