//图片非原创
图片如图:
会详细介绍map—abstractmap—-hashmap—sortedmap–treemap—hashtable–set—sortedset-abstractset–hashset–treeset
1.map接口和abstractmap抽象类
public interface Map<K,V> {
int size(); // --abstractmap
boolean isEmpty();//判断是否为空---abstractmap
boolean containsKey(Object key);//判断是否包含key --abstractmap
boolean containsValue(Object value);//判断是否包含value--abstractmap
V get(Object key);//根据key得--abstractmap
V remove(Object key); //根据k删除?--abstractmap
void putAll(Map<? extends K, ? extends V> m); --abstractmap
void clear(); --abstractmap
Set<K> keySet();--abstractmap
Collection<V> values();--abstractmap
Set<Map.Entry<K, V>> entrySet(); //产生set容器,容器中是entry元素
interface Entry<K,V> {
K getKey();
V getValue();
V setValue(V value);
boolean equals(Object o);
int hashCode();
}
boolean equals(Object o);
int hashCode();
}
AbstractMap
public boolean equals(Object o)-----abstractmap
public int hashCode() -----abstractmap
public String toString() -----abstractmap
protected Object clone() throws CloneNotSupportedException -----abstractmap
private static boolean eq(Object o1, Object o2)-----abstractmap
内部类:
1 public static class SimpleEntry<K,V>
implements Entry<K,V>, java.io.Serializable
2 public static class SimpleImmutableEntry<K,V>
implements Entry<K,V>, java.io.Serializable
属性:
transient volatile Set<K> keySet = null;
transient volatile Collection<V> values = null;