当前位置:网站首页>ArrayList集合
ArrayList集合
2022-07-06 09:25:00 【手可摘鑫晨】
1.ArrayList集合的基本方法
导包:java.util;
ArrayList<数据类型> 变量名名 = new ArrayList <数据类型> ();
注意:数据类型必须是引用数据类型
2.ArrayList集合的常用方法
boolean add(E e) 添加指定元素至集合末尾,返回元素是否添加成功。
void add(int index,E e) 在指定位置添加元素。
E get(int index) 返回索引值为index的元素。
E set(int index , E e) 修改指定索引值元素,返回修改后元素。
boolean remove(Object o) 删除指定元素,返回删除是否成功。
E remove(int index) 删除指定位置元素,返回被删除的元素。
int size() 返回集合元素的个数。
int indexOf(Object obj) 返回元素第一次出现的索引值位置。
int lastlndexOf(Object obj) 返回元素最后一次出现的索引值位置。
boolean contains(Object obj) 判断是否包含该元素。
3.ArrayList储存基本数据类型
基本类型 包装类型
int Integer
char Character
byte Byte
short Short
long Long
float Float
double Double
boolean Boolean
边栏推荐
- Pedestrian re identification (Reid) - data set description market-1501
- The latest query tracks the express logistics and analyzes the method of delivery timeliness
- Fundamentals of digital circuits (III) encoder and decoder
- What is an index in MySQL? What kinds of indexes are commonly used? Under what circumstances will the index fail?
- {1,2,3,2,5} duplicate checking problem
- CSAPP家庭作業答案7 8 9章
- Logstack introduction and deployment -- elasticstack (elk) work notes 019
- Express
- What are the business processes and differences of the three basic business modes of Vos: direct dial, callback and semi direct dial?
- ucore lab6 调度器 实验报告
猜你喜欢
自动化测试你必须要弄懂的问题,精品总结

How to rename multiple folders and add unified new content to folder names

想跳槽?面试软件测试需要掌握的7个技能你知道吗

Heap, stack, queue
![Cadence physical library lef file syntax learning [continuous update]](/img/0b/75a4ac2649508857468d9b37703a27.jpg)
Cadence physical library lef file syntax learning [continuous update]

安全测试入门介绍

Réponses aux devoirs du csapp 7 8 9

CSAPP Shell Lab 实验报告

Fundamentals of digital circuits (III) encoder and decoder

Cc36 different subsequences
随机推荐
Global and Chinese market for antiviral coatings 2022-2028: Research Report on technology, participants, trends, market size and share
The common methods of servlet context, session and request objects and the scope of storing data in servlet.
UCORE lab8 file system experiment report
Fundamentals of digital circuits (I) number system and code system
Software testing interview summary - common interview questions
Zhejiang University Edition "C language programming experiment and exercise guide (3rd Edition)" topic set
How to rename multiple folders and add unified new content to folder names
To brush the video, it's better to see if you have mastered these interview questions. Slowly accumulating a monthly income of more than 10000 is not a dream.
Stc-b learning board buzzer plays music
If the position is absolute, touchablehighlight cannot be clicked - touchablehighlight not clickable if position absolute
Global and Chinese market of portable and handheld TVs 2022-2028: Research Report on technology, participants, trends, market size and share
ucore lab2 物理内存管理 实验报告
CSAPP homework answers chapter 789
C language do while loop classic Level 2 questions
Leetcode simple question: check whether the numbers in the sentence are increasing
Logstack introduction and deployment -- elasticstack (elk) work notes 019
[Ogg III] daily operation and maintenance: clean up archive logs, register Ogg process services, and regularly back up databases
Differences between select, poll and epoll in i/o multiplexing
Flash implements forced login
Eigen User Guide (Introduction)