public class HashMap<K,V> extends AbstractMap<K,V>
implements Map<K,V>, Cloneable, Serializable {
hashmap继承abstractMap,实现map、Cloneable、Serializable
public abstract class AbstractMap<K,V> implements Map<K,V> {
abstractmap实现map
public interface Map<K,V> {
一、table变量
底层数据结构,是hashmap静态内部类Node的变量,node是一种数组加链表的底层数据结构
static class Node<K,V> implements Map.Entry<K,V> {
final int hash;
final K key;
V value;
Node<K,V> next;
Node(int hash, K key, V value, Node<K,V> next) {
this.hash = hash;
this.key = key;
this.value = value;
this.next = next;
}
数组和链表有各自的优点<