当前位置:网站首页>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
边栏推荐
- ucore lab8 文件系统 实验报告
- MySQL数据库(一)
- Global and Chinese markets of MPV ACC ECU 2022-2028: Research Report on technology, participants, trends, market size and share
- 软件测试面试回答技巧
- {1,2,3,2,5} duplicate checking problem
- What are the business processes and differences of the three basic business modes of Vos: direct dial, callback and semi direct dial?
- Global and Chinese market of RF shielding room 2022-2028: Research Report on technology, participants, trends, market size and share
- UCORE lab1 system software startup process experimental report
- Software testing interview summary - common interview questions
- 想跳槽?面试软件测试需要掌握的7个技能你知道吗
猜你喜欢
150 common interview questions for software testing in large factories. Serious thinking is very valuable for your interview
Practical cases, hand-in-hand teaching you to build e-commerce user portraits | with code
Express
Report on the double computer experiment of scoring system based on 485 bus
Fundamentals of digital circuits (III) encoder and decoder
Vysor uses WiFi wireless connection for screen projection_ Operate the mobile phone on the computer_ Wireless debugging -- uniapp native development 008
The minimum number of operations to convert strings in leetcode simple problem
UCORE lab2 physical memory management experiment report
UCORE lab8 file system experiment report
自动化测试你必须要弄懂的问题,精品总结
随机推荐
How to use Moment. JS to check whether the current time is between 2 times
UCORE lab8 file system experiment report
软件测试面试回答技巧
软件测试面试要问的性能测试术语你知道吗?
Cadence physical library lef file syntax learning [continuous update]
[HCIA continuous update] working principle of static route and default route
Cadence physical library lef file syntax learning [continuous update]
MySQL数据库(二)DML数据操作语句和基本的DQL语句
Programmers, how to avoid invalid meetings?
Detailed introduction to dynamic programming (with examples)
Capitalize the title of leetcode simple question
Global and Chinese market of maleic acid modified rosin esters 2022-2028: Research Report on technology, participants, trends, market size and share
Mysql database (IV) transactions and functions
Login the system in the background, connect the database with JDBC, and do small case exercises
Fundamentals of digital circuits (III) encoder and decoder
Global and Chinese market of barrier thin film flexible electronics 2022-2028: Research Report on technology, participants, trends, market size and share
想跳槽?面试软件测试需要掌握的7个技能你知道吗
基于485总线的评分系统双机实验报告
China's county life record: go upstairs to the Internet, go downstairs' code the Great Wall '
Logstack introduction and deployment -- elasticstack (elk) work notes 019