java基础之ConcurrentHashMap

来源:互联网 发布:les petit joueurs淘宝 编辑:程序博客网 时间:2024/06/01 20:35

1、基础不牢固,请问接口里面怎么有方法? 这个和一般的方法有啥区别?

public interface ConcurrentMap<K, V> extends Map<K, V> {    /**     * {@inheritDoc}     *     * @implNote This implementation assumes that the ConcurrentMap cannot     * contain null values and {@code get()} returning null unambiguously means     * the key is absent. Implementations which support null values     * <strong>must</strong> override this default implementation.     *     * @throws ClassCastException {@inheritDoc}     * @throws NullPointerException {@inheritDoc}     * @since 1.8     */    @Override    default V getOrDefault(Object key, V defaultValue) {        V v;        return ((v = get(key)) != null) ? v : defaultValue;    }

2、

原创粉丝点击