学习Java数据结构-集合

http://zh.visualgo.net/
Note: 数据集合存储结构,默认no synchronized,允许NULL,允许duplicate
Tree结构支持内部元素根据指定的规则排序

Collection
├List
│├LinkedList
│├ArrayList
│└Vector
│ └Stack
└Set
├HashSet
├TreeSet
Map
├Hashtable
├TreeMap
├HashMap
└WeakHashMap

Collection

List

  • LinkedList
  • 实现了List, Deque, Queue
  • List 【Every* element in the {@code List} has an index;allow duplicate* elements, as compared to Sets, where elements have to be unique】
  • Deque 【double ended queue】【FIFO (First-In-First-Out) 】【Deques can also be used as LIFO (Last-In-First-Out) stacks】

注:push-pollLast 满足LIFO
add-poll满足FIFO

  • you should probably use {@link ArrayList} if you don't need the queue-like behavior.
  • ArrayList

ArrayList is an implementation of {@link List}, backed by an array.

  • Vector

Vector is an implementation of {@link List}, backed by an array and synchronized.

  • Stack
  • {@code Stack} is a **Last-In/First-Out(LIFO) *data structure which represents a stack of objects.
  • including null objects. There is no limit to the size of the stack.

Set

(A {@code Set} is a data structure which does not allow duplicate elements.)

  • TreeSet
  • 实现了SortedSet接口,支持元素排序
  • HashSet

Map

A {@code Map} is a data structure consisting of a set of keys and values in which each key is mapped to a single value.

  • HashTable
  • Hashtable is a synchronized implementation of {@link Map}. All optional operations are supported.
  • **Neither keys nor values can be null. *(Use {@code HashMap} or {@code LinkedHashMap} if you need null keys or values.)
  • TreeMap

A map whose entries are sorted by their keys.

  • HashMap

Note: the implementation of {@code HashMap} is not synchronized.

  • WeakHashMap

WeakHashMap is an implementation of Map with keys which are WeakReferences.

  • LinkedHashMap

doubly-linked list

你可能感兴趣的:(学习Java数据结构-集合)