迭代器与Collection、Map集合

1.Iterable接口与Collection:由于Collection集合(List、Set、Queue)继承了Iterable接口,因此迭代及foreach适用于任何Collection对象。 2.Iterable接口与Map:由于Map接口没有继承Iterable接口,因此Map对象不能直接使用迭代及foreach,但是Map.entrySet()、Map.keySet()、Map.valu
相关文章
相关标签/搜索