Lazy loaded image
Java - 集合
Words 457Read Time 2 min
2025-4-7
2025-6-15
type
status
date
slug
summary
tags
category
icon
password

一、Collection

1.集合框架图

notion image
notion image

2.Collection的方法

int size();
boolean isEmpty();
boolean contains(Object o);
boolean add(E e);
boolean remove(Object o);
boolean containsAll(Collection<?> c);
boolean addAll(Collection<? extends E> c);
boolean removeAll(Collection<?> c);
void clear();

3.集合的遍历

3.1 Iterator

3.2增强for循环

for(遍历对象的类型 遍历变量:要遍历集合的名称)
增强for循环的底层仍然是Iterator迭代器

二、List

List接口实现的方法,存取是有序且可重复的!

1、list的方法

2、List的遍历

3、List的注意事项

1.list的底层用数组实现
2.ArrayList是线程不安全的
3.List可以加入null值

4、List源码

 
上一篇
Spring - AOP
下一篇
如何用Notion+Vercel+Github搭建一个属于自己的个人博客?

Comments
Loading...