values
public Collection values()
Returns a collection view of the values contained in this map. The collection is backed by the map, so changes to the map are reflected in the collection, and vice-versa. If the map is modified while an iteration over the collection is in progress, the results of the iteration are undefined. The collection supports element removal, which removes the corresponding mapping from the map, via the Iterator.remove, Collection.remove, removeAll, retainAll and clear operations. It does not support the add or addAll operations. keySet
public Set 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, the results of the iteration are undefined. The set supports element removal, which removes the corresponding mapping from the map, via the Iterator.remove, Set.remove, removeAll retainAll, and clear operations. It does not support the add or addAll operations. Returns:
a set view of the keys contained in this map.
Returns:
a collection view of the values contained in this map.
public Collection values()
Returns a collection view of the values contained in this map. The collection is backed by the map, so changes to the map are reflected in the collection, and vice-versa. If the map is modified while an iteration over the collection is in progress, the results of the iteration are undefined. The collection supports element removal, which removes the corresponding mapping from the map, via the Iterator.remove, Collection.remove, removeAll, retainAll and clear operations. It does not support the add or addAll operations. keySet
public Set 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, the results of the iteration are undefined. The set supports element removal, which removes the corresponding mapping from the map, via the Iterator.remove, Set.remove, removeAll retainAll, and clear operations. It does not support the add or addAll operations. Returns:
a set view of the keys contained in this map.
Returns:
a collection view of the values contained in this map.
解决方案 »
- 当String的split遇到“|”
- 闰年问题!
- 还是iReport的问题:无法确定左边有多少组
- 谁推荐一个比小颖厉害的反编译工具啊
- 执行jar文件问题
- jtable怎样设置某列的值不能被修改,整张表呢?某个元素被修改后,怎样取处修改后的值?
- 求人力资源程序源码学习一下
- 菜鸟朋友问菜鸟一个问题,菜鸟不知做,请java高手帮忙啊??否则菜鸟的牛就白吹了!!!
- 请问这是什么错误??
- 那里有中文版的java函数库
- 请问如何对一个浮点数进行取整数部分和取小数部分的操作?请问如何实现对浮点数取整。
- 《Thinking in Java》里关于线程群组的一个Bug,麻烦大家帮帮忙,这也许是第三版会改进的地方!
Collection是聚集的意思,但凡是元素聚在一起就是聚集.
Set除了聚集的含义之外,还强调唯一性,所以keySet当然返回Set,因为key通常都是唯一的.你可以看看Collection的三种基本派生:
List:强调顺序
Set:强调唯一
Map:强调唯一和值对
key是唯一的,所以keySet()返回Set,强调唯一;
Values是可以不唯一的,所以values()返回Collection,强调聚集;