List集合
来源:互联网 发布:玄空排盘软件 编辑:程序博客网 时间:2024/06/16 23:21
list 是个接口,不能new
要new子类
|--ArryList
|--linkList
List:有序(输入,输出顺序),可重复的集合有角标的.
修改
set
set(int index, E element)
用指定元素替换列表中指定位置的元素(可选操作)。
查询
get(int index)
返回列表中指定位置的元素。
indexOf(Object o)
返回此列表中第一次出现的指定元素的索引;如果此列表不包含该元素,则返回 -1
lastIndexOf(Object o)
返回此列表中最后出现的指定元素的索引;如果列表不包含此元素,则返回 -1。
subList(int fromIndex, int toIndex)
返回列表中指定的 fromIndex(包括 )和 toIndex(不包括)之间的部分视图。
|--ArrayList内部是数组数据结构,是不同步。 查迅元素速度 替代Vextor. A ray list
|--linkedList:内部是连接数据结构,不同步. 增删元素的剫很快 Link 琳 list
peekFirst();获取但不移除,如果链表为空,返回null
peeklast();
getFirst();获取但不移除,如果链表为空,抛出Nosunelementexcptionp
getlast();
pollfirst();
remove();
offer
set
int[] a_int = { 1, 2, 3, 4 };
List a=Array.asList(a_int);
a不能用add.remove方法
要转为list子类才行
ArrayList b=new Arraylist(a);
- list 集合
- List集合
- List集合
- List集合
- List集合
- List集合
- list 集合
- List集合
- 集合 --- List
- 集合(List)
- List集合
- 集合-List
- List集合
- list集合
- List集合
- List集合
- List集合
- List 集合
- java面试题集锦(一)
- centos 7 minal 搭建ffmpeg+segmenter环境
- Apache Beam Fn API如何接收和发送数据
- 介绍托管程序与非托管程序的区别
- STL_vector的常用函数
- List集合
- 1012. 数字分类
- 两种隐藏元素方式【display: none】和【visibility: hidden】的区别
- Linux常用命令之ls file less
- java面试题集锦(二)
- HBase和Phoenix的整合
- java鬼混笔记:springboot 2、springboot修改访问端口
- linux ioctl()详解
- centos安装oracleJDK