29.列表(集合)ArrayList LinkedList
2016-04-09 09:37
567 查看
List集合(接口类)
是Collection接口类的子接口,也是最常用的接口。此接口对Collection接口进行了大量的扩展,List集合里的元素允许重复。
具体实现类
ArrayList实现类
实现可变数组
LinkedList实现类
功能最强大
是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实现类
功能最强大
相关文章推荐
- mysql
- java分支结构
- javaNumber类
- Tornado框架
- 开源HA软件keepalived的介绍
- ElasticSearch 分布式安装及调优
- Educational Codeforces Round 11---B-Seating On Bus
- java循环结构
- java循环结构
- 使用Spring的TaskExecutor的线程池执行异步操作
- 两种 设置 背景图片方法
- B - 分拆素数和
- 全面解析iOS应用中自定义UITableViewCell的方法
- Win10应用更新开始提供日志 能知道到底升级了什么内容
- LVS集群的组成与特定
- 快速幂运算
- C++服务器(七):Windows 下配置pthread
- 关系型数据库
- java修饰符
- java运算符