6、LinkList的使用
(1)使用链表结构实现、增删快但是查询慢
- 添加元素
//创建链表集合
LinkedList linkedList=new LinkedList ();
//添加元素
Student s1=new Student ("lym",10);
Student s2=new Student ("yummy",10);
Student s3=new Student ("happy",10);
linkedList.add (s1);
linkedList.add (s2);
linkedList.add (s3);
System.out.println (linkedList.size ());
System.out.println (linkedList.toString ());
- 删除测试
//删除元素
linkedList.remove (