容器

参考:https://blog.csdn.net/biexiaofei/article/details/77031003

 

以上几种类型之间的转换:

1-Map-Collection

List<String> valuelist = (List<String>) map.values();

Set<Map.Entry<Integer,String>> set = map.entrySet();

2-Collection-Iterator

Collection c =new ArrayList();

Iterator it = c.iterator();

3-Map-Iterator

Iterator<String> iter = map.keySet().iterator();

4-List-ListIterator

ListIterator接口继承了Iterator接口,它是为List量身打造的,可以双向遍历并且在遍历的过程中修改元素的值,List接口的各种实现类中都实现了其中的方法。

 

posted @ 2018-07-20 09:29  mxgboy  阅读(160)  评论(0)    收藏  举报