当前位置:网站首页>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
边栏推荐
- The common methods of servlet context, session and request objects and the scope of storing data in servlet.
- 线程及线程池
- [pytorch] simple use of interpolate
- 接口测试面试题及参考答案,轻松拿捏面试官
- [200 opencv routines] 98 Statistical sorting filter
- Mysql的事务
- Wang Shuang's detailed notes on assembly language learning I: basic knowledge
- Introduction to variable parameters
- Expanded polystyrene (EPS) global and Chinese markets 2022-2028: technology, participants, trends, market size and share Research Report
- [Ogg III] daily operation and maintenance: clean up archive logs, register Ogg process services, and regularly back up databases
猜你喜欢
Practical cases, hand-in-hand teaching you to build e-commerce user portraits | with code
Video scrolling subtitle addition, easy to make with this technique
MySQL数据库(一)
The number of reversing twice in leetcode simple question
软件测试方法有哪些?带你看点不一样的东西
Heap, stack, queue
CSAPP家庭作業答案7 8 9章
Threads and thread pools
Logstack introduction and deployment -- elasticstack (elk) work notes 019
Fundamentals of digital circuits (II) logic algebra
随机推荐
My first blog
Description of Vos storage space, bandwidth occupation and PPS requirements
软件测试行业的未来趋势及规划
Global and Chinese markets for GaN on diamond semiconductor substrates 2022-2028: Research Report on technology, participants, trends, market size and share
[oiclass] maximum formula
A method and implementation of using VSTO to prohibit excel cell editing
What is an index in MySQL? What kinds of indexes are commonly used? Under what circumstances will the index fail?
Global and Chinese market for antiviral coatings 2022-2028: Research Report on technology, participants, trends, market size and share
What level do 18K test engineers want? Take a look at the interview experience of a 26 year old test engineer
Summary of thread implementation
Query method of database multi table link
What is the transaction of MySQL? What is dirty reading and what is unreal reading? Not repeatable?
About the garbled code problem of superstar script
Build your own application based on Google's open source tensorflow object detection API video object recognition system (I)
[oiclass] share prizes
ucore lab8 文件系统 实验报告
Global and Chinese markets of PIM analyzers 2022-2028: Research Report on technology, participants, trends, market size and share
In Oracle, start with connect by prior recursive query is used to query multi-level subordinate employees.
软件测试Bug报告怎么写?
Maximum nesting depth of parentheses in leetcode simple questions