Set of variable length Java - ArrayList class

Set of variable length Java - ArrayList class

Blog Description

Information in the article involved from the Internet and organize personal conclusion, meaning that the individual learning experience and summary, what if infringement, please contact me to delete, thank you!

Explanation

ArrayList is an implementation of the collection, implements the interface List, List interface extends the Collection interface. Collection is the parent class of all collections

usage

//创建
ArrayList<String> list = new ArrayList<>();

Common method

add,addAll,set,get,remove,size,isEmpty等

add (E element) added
list.add('小明');
set (int index, E element) inserted
list.set(3,'小花');
get (int index) Gets
list.get(1);
remove (int index) Delete
list.remove(1);

thank

Baidu Encyclopedia

Universal Network

And a hardworking own

He published 183 original articles · won praise 491 · views 20000 +

Guess you like

Origin blog.csdn.net/qq_45163122/article/details/105034715