集合的常见方法以及遍历方式:
Collection:
add()
remove()
contains()
iterator()
size()
遍历:
增强for
迭代器
List:
因为有get()
遍历:
增强for
迭代器
普通for
Set:
遍历:
增强for
迭代器
Map:
put()
remove()
containskey(),containsValue()
keySet()
get()
value()
entrySet()
size()
遍历:
根据键找值
根据键值对对象分别找键和值