Map.Entry接口源码简析

来源:互联网 发布:你见过最恐怖的事 知乎 编辑:程序博客网 时间:2024/06/03 15:42

Map.Entry源码简介

interface Map<K,V>{ interface Entry<K,V> {      //接口里面又定义了接口 内部接口    K getKey();   V getValue(); }}
public class HashMap<K,V> implements Map<K,V>{   //实现类 实现了Map中的内部接口Entry  static class Entry<K,V> implements Map.Entry<K,V> {  final K key;        V value;    Entry(K k, V v) {            value = v;            next = n;        }        public final K getKey() {            return key;        }        public final V getValue() {            return value;        }    }}
0 0