您的位置:首页 > 其它

29.列表(集合)ArrayList LinkedList

2016-04-09 09:37 567 查看
List集合(接口类)

是Collection接口类的子接口,也是最常用的接口。此接口对Collection接口进行了大量的扩展,List集合里的元素允许重复。

具体实现类

ArrayList实现类

实现可变数组

public class TestArrayList {
private static Student printArrayList(ArrayList<Student> s) {

System.out.println("当前元素结合:");
for(int i =0; i<s.size();i++){
System.out.println(s.get(i));
}
return null;
}

public static void main(String[] args) {
Student s1 = new Student("bob", false);
Student s2 = new Student("李四", true);
ArrayList<Student> arrayList = new ArrayList<Student>();
arrayList.add(s1);
arrayList.add(s2);
printArrayList(arrayList);

}

}

当前元素结合:
com.gavin29.Student@139a55
com.gavin29.Student@1db9742




LinkedList实现类

功能最强大
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: