Collection之List方法和分类
来源:互联网 发布:矩阵相加 编辑:程序博客网 时间:2024/05/21 07:00
List:特有的常见方法:
其他常见方法见本博客中的 Collection大家族文章
1,添加
void add(index,element);
void addAll(index,collection);
2,删除;
Object remove(index):
3,修改:
Object set(index,element);
4,获取:
Object get(index);
int indexOf(object);
int lastIndexOf(object);
List的分类:
|--Vector:内部是数组数据结构,是同步的。增删,查询都很慢!
|--ArrayList:内部是数组数据结构,是不同步的。替代了Vector。查询的速度快。
|--LinkedList:内部是链表数据结构,是不同步的。增删元素的速度很快。
其他常见方法见本博客中的 Collection大家族文章
1,添加
void add(index,element);
void addAll(index,collection);
2,删除;
Object remove(index):
3,修改:
Object set(index,element);
4,获取:
Object get(index);
int indexOf(object);
int lastIndexOf(object);
List subList(from,to);
5.特有方法:
ListIterator lit = List.listIterator();可以在迭代过程中对集合元素进行操作:
while(lit.hasNext()){Object obj = lit.next();if(obj.equals("abc2")){ lit.set("abc9");//lit.add("abc9"); } }
List的分类:
|--Vector:内部是数组数据结构,是同步的。增删,查询都很慢!
|--ArrayList:内部是数组数据结构,是不同步的。替代了Vector。查询的速度快。
|--LinkedList:内部是链表数据结构,是不同步的。增删元素的速度很快。
0 0
- Collection之List方法和分类
- Collection源码学习之List.listIterator方法
- Collection和List接口的remove方法
- Collection框架之Set和List
- Collection 之List
- Collection集合之List
- 集合Collection之List
- 集合之Collection、List
- Collection之List集合
- Collection和List区别
- 接口Collection和List
- Collection接口和List接口中常用的方法
- List和Set中忽略的方法addAll(Collection c)和retainAll(Collection c)
- List和Set中忽略的方法addAll(Collection c)和retainAll(Collection c)
- Collection集合之六大接口(Collection、Set、List、Map、Iterator和Comparable)
- Collection集合之六大接口(Collection、Set、List、Map、Iterator和Comparable)
- Collection集合之六大接口(Collection、Set、List、Map、Iterator和Comparable)
- Collection集合之六大接口(Collection、Set、List、Map、Iterator和Comparable)
- Codeforces 237C Primes on Interval
- PAT乙级1013
- 位运算全解(含位段)
- 关于封包工具一上午的研究总结
- Git Merge
- Collection之List方法和分类
- 模板学习笔记2
- 解读 RtlConvertNtFilePathToWin32FilePath
- 浅析this指针
- C++11 (二)
- nginx配置笔记
- 如何安装SQL Server 2008数据库(带完整图解)
- Struts2中的拦截器interceptor
- openlayers3.14源码学习(1)