复习下:
collection保存单一元素、Map保持键值对形式
这两个是最基础的容器接口
collection有三个继承接口:List、Set、Queue
list的实现有ArrayList(随即插入查找)、LinkedList(队列),
Set的实现有HashSet(无重复),TreeSet(自动排序)
Queue实现:PriorityQueue(有移除权值属性)
Map的实现有:HashMap、TreeMap
Vector(指针)。hashtable、stack已经过时。。。
java.util.Collections里面包含很多方法,如排序
Collections.sort(list);
iterator是一个方法接口,
public interface Iterator {
boolean hasNext();
Object next();
void remove();
}
LinkedList实现上述方法,实现如
for(type c:list
。。。}
这样的遍历
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/22259926/viewspace-659513/ ,如需转载,请注明出处,否则将追究法律责任。