0%

绘图url:http://www.plantuml.com/plantuml/uml/SyfFKj2rKt3CoKnELR1Io4ZDoSa70000

Object

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
@startuml
class Object {
# native Object clone()
# native Object finalize()
+ final Class<?> getClass()
+ boolean equals(Object obj)
+ String toString()
+ native int hashCode()
+ final native void notify()
+ final native void notifyAll()
+ final native void wait()
+ final native void wait(long timeout)
+ final native void wait(long timeout, int nanos)
}
@enduml

Exception:

1
2
3
4
5
6
7
8
9
10
11
12
@startuml
Object <|-- Throwable
Throwable <|-- Error
Error <|-- VirtualMachineError
VirtualMachineError <|-- StackOverflowException
VirtualMachineError <|-- OutOfMemoryException
Throwable <|-- Exception
Exception <|-- RuntimeException
Exception <|-- IOException
IOException <|-- FileNotFoundException
RuntimeException <|-- IOException
@enduml

ArrayList:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
@startuml
interface List{}
interface RandomAccess{}
interface Cloneable{}
interface Collection{}
interface Serializable{}
class AbstractCollection{}
class AbstractList{
# transient int modCount
}
class ArrayList{
- static final int DEFAULT_CAPACITY
- static final Object[] EMPTY_ELEMENTDATA
- static final Object[] DEFAULTCAPACITY_EMPTY_ELEMENTDATA
- static final int MAX_ARRAY_SIZE
- int size
# transient Object[] elementData
+ boolean add(E e)
+ boolean addAll(Collection<? extends E> c)
+ boolean remove(E e)
+ boolean remove(int index)
+ E get(int index)
+ int indexOf(Object o)
}

Collection <|.. AbstractCollection
AbstractCollection <|-- AbstractList
List <|.. ArrayList
List <|.. AbstractList
RandomAccess <|..ArrayList
AbstractList <|.. ArrayList
Cloneable <|.. ArrayList
Serializable <|.. ArrayList
@enduml

CopyOnWriteArrayList:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
@startuml
interface List{}
interface RandomAccess{}
interface Cloneable{}
interface Serializable{}
interface Collection{}
class CopyOnWriteArrayList{
# final transient ReentrantLock lock : default new ReentrantLock()
- transient volatile Object[] array
- static final sun.misc.Unsafe UNSAFE
- static final long lockOffset
+ boolean add(E e)
+ boolean remove(E e)
+ boolean remove(int index)
+ E get(int index)
+ int indexOf(Object o)
}
List <|.. CopyOnWriteArrayList
Collection <|-- List
RandomAccess <|..CopyOnWriteArrayList
Cloneable <|.. CopyOnWriteArrayList
Serializable <|.. CopyOnWriteArrayList
@enduml

LinkedList:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
@startuml
interface List{}
interface Cloneable{}
interface Serializable{}
class Node{
E item
Node<E> next
Node<E> prev
}
interface Deque{
void addFirst(E e)
void addLast(E e)
E removeFirst()
E removeLast()
...()
}
interface Queue{}
interface Collection{}
Queue <|-- Deque
Collection <|-- Queue
class LinkedList{
- transient int size
- transient Node<E> first
- transient Node<E> last
+ boolean add(E e)
+ boolean addAll(Collection<? extends E> c)
+ boolean remove(E e)
+ boolean remove(int index)
+ E get(int index)
+ int indexOf(Object o)
}

Deque <|.. LinkedList
Collection <|-- List
List <|.. LinkedList
AbstractSequentialList <|-- LinkedList
AbstractList <|-- AbstractSequentialList
AbstractCollection<|-- AbstractList
List <|.. AbstractCollection
Cloneable <|.. LinkedList
Serializable <|.. LinkedList
LinkedList +-- Node
@enduml

HashMap

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
@startuml
interface Map{}
interface Cloneable{}
interface Serializable{}
abstract class AbstractMap<K,V>{}
class LinkedHashMap<K,V>{}
class HashMap<K,V>{
static final int DEFAULT_INITIAL_CAPACITY
static final int MAXIMUM_CAPACITY
static final float DEFAULT_LOAD_FACTOR
static final int TREEIFY_THRESHOLD
static final int UNTREEIFY_THRESHOLD
static final int MIN_TREEIFY_CAPACITY
final float loadFactor
int threshold
transient int size
transient int modCount
transient Node<K,V>[] table
transient Set<Map.Entry<K,V>> entrySet
}
Map <|.. AbstractMap
Serializable <|.. HashMap
Cloneable <|.. HashMap
AbstractMap <|-- HashMap
HashMap <|-- LinkedHashMap
Map <|.. LinkedHashMap


interface Map.Entry<K,V>{
K getKey()
V getValue()
}

class HashMap.Node<K,V> implements Map.Entry {
final int hash
final K key
V value
Node<K,V> next
}


class LinkedHashMap.Entry<K,V> extends HashMap.Node{
Entry<K,V> before, after
}

class HashMap.TreeNode<K,V> extends LinkedHashMap.Entry {
TreeNode<K,V> parent
TreeNode<K,V> left
TreeNode<K,V> right
TreeNode<K,V> prev
boolean red
}
@enduml