/*
LinkedList
LinkedList实现类:底层是链表的结构实现的,特点是查询慢,增删快
特有方法:
addFirst();
addLast();
getFirst();
getLast()
removeFirst();
removeLast();
*/
class LinkedList
{
public static void main(String[] args){
LinkedList link=new LinkedList();
link.addFirst("01");
link.addFirst("02");
link.addFirst("03");
link.addFirst("04");
//sop(link);
//sop(link.getFirst());
//sop(link.getLast());
sop(link.removeFirst());
sop("size()="+link.size());
//特殊遍历方法
while(link.isEmpty()){
sop(link.removeFirst())
}
}
public static void sop(Object obj){
System.out.println(obj);
}
}
LinkedList
LinkedList实现类:底层是链表的结构实现的,特点是查询慢,增删快
特有方法:
addFirst();
addLast();
getFirst();
getLast()
removeFirst();
removeLast();
*/
class LinkedList
{
public static void main(String[] args){
LinkedList link=new LinkedList();
link.addFirst("01");
link.addFirst("02");
link.addFirst("03");
link.addFirst("04");
//sop(link);
//sop(link.getFirst());
//sop(link.getLast());
sop(link.removeFirst());
sop("size()="+link.size());
//特殊遍历方法
while(link.isEmpty()){
sop(link.removeFirst())
}
}
public static void sop(Object obj){
System.out.println(obj);
}
}