java.util.AbstractMap

package java.util;

简介

This class provides a skeletal implementation of the Map interface, to minimize the effort required to implement this interface.

结构

查询操作

// Query Operations
public int size() {
    return entrySet().size();
}
public boolean isEmpty() {
    return size() == 0;
}
// entrySet().iterator(),循环,注意null
boolean containsKey(Object key);
// entrySet().iterator(),循环,注意null
boolean containsValue(Object value);
// entrySet().iterator(),循环,注意null
V get(Object key);

关注点

entrySet()

simpleEntry

public static class SimpleEntry
        implements Entry, java.io.Serializable {
}

为什么 key 用 final 修饰?

SimpleImmutableEntry

public static class SimpleImmutableEntry
        implements Entry, java.io.Serializable {
}

为什么 key 和 value 用 final 修饰?

你可能感兴趣的:(java.util.AbstractMap)