Java Collections

2019/01/08 blog

目录

List 实现:

Java LinkedList 指南

1.介绍

LinkedList 是双链接列表数据结构,实现了 ListDeque 接口。其实现了列表的所以操作方法,可以添加任意元素(包括 null)。

2.功能特性

LinkedList 最主要的功能特性如下:

  • 查找元素操作需要遍历整个列表
  • 不是 synchronized
  • Iterator 操作时不能个性元素,否则会抛出 ConcurrentModificationException 异常
  • 每个元素都是一个节点,存储有下一个节点和上一个节点的引用
  • 保持着元素插入时的顺序

虽然 LinkedList 不是线程同步的,我们也可以调用 Collections.synchronizedList 方法来使其达到同步目的:

List list = Collections.synchronizedList(new LinkedList(...));

3. 与 ArrayList 比较

3.1 数据结构

3.2 操作

3.3 内存使用情况

4. 使用

4.1 创建

4.2 添加元素

4.3 删除元素

4.4 队列操作

5. 结论


Java ArrayList 指南

Java ArrayList 中的不可变性

CopyOnWriteArrayList 使用指南

List 操作

-Java – Get Random Item/Element From a List

- Partition a List in Java

- Removing all nulls from a List in Java

- Removing all duplicates from a List in Java

- Removing all Nulls from a List in Java

- Check If Two Lists are Equal in Java

- How to Find an Element in a List with Java

- Java List UnsupportedOperationException

- Copy a List to Another List in Java

- Remove All Occurrences of a Specific Value from a List

- Add Multiple Items to an Java ArrayList

- Remove the First Element from a List

Search

    Table of Contents