package com.mjy.map;

/**
 * ***************************************************
 * @ClassName Map
 * @Description map接口
 * @Author maojianyun
 * @Date 2020/1/9 21:54
 * @Version V1.0
 * ****************************************************
 **/
public interface Map<K, V> {
    /**
     * 元素个数
     * @return
     */
    int size();

    /**
     * 是否为空
     * @return
     */
    boolean isEmpty();

    /**
     *  清空
     */
    void clear();

    /**
     * 添加元素
     * @param key
     * @param value
     * @return
     */
    V put(K key, V value);

    /**
     * 得到元素
     * @param key
     * @return
     */
    V get(K key);

    /**
     * 移除元素
     * @param key
     * @return
     */
    V remove(K key);

    /**
     * 是否包涵key
     * @param key
     * @return
     */
    boolean containsKey(K key);

    /**
     * 是否包涵值
     * @param value
     * @return
     */
    boolean containsValue(V value);

    /**
     * 遍历接口
     * @param visitor
     */
    void traversal(Visitor<K, V> visitor);

    public static abstract class Visitor<K, V> {
        boolean stop;
        public abstract boolean visit(K key, V value);
    }
}
最近下载更多
matintalorr  LV10 2021年8月31日
最代码官方  LV167 2020年1月11日
最近浏览更多
graceful 2023年10月18日
暂无贡献等级
666ing  LV2 2023年2月26日
学不会代码就去种地 2022年11月22日
暂无贡献等级
绘飛的渔 2022年8月2日
暂无贡献等级
yuyan701  LV1 2022年1月1日
matintalorr  LV10 2021年8月31日
smile 2021年6月10日
暂无贡献等级
絮落无痕  LV13 2021年4月21日
Killah  LV9 2021年4月16日
zarathurstra 2020年11月6日
暂无贡献等级
顶部 客服 微信二维码 底部
>扫描二维码关注最代码为好友扫描二维码关注最代码为好友