本文共 1580 字,大约阅读时间需要 5 分钟。
/** * Exported Entry for EntryIterator */ static final class MapEntryimplements Map.Entry { final K key; // non-null V val; // non-null final ConcurrentHashMap map; MapEntry(K key, V val, ConcurrentHashMap map) { this.key = key; this.val = val; this.map = map; } public K getKey() { return key; } public V getValue() { return val; } public int hashCode() { return key.hashCode() ^ val.hashCode(); } public String toString() { return key + "=" + val; } public boolean equals(Object o) { Object k, v; Map.Entry e; return ((o instanceof Map.Entry) && (k = (e = (Map.Entry )o).getKey()) != null && (v = e.getValue()) != null && (k == key || k.equals(key)) && (v == val || v.equals(val))); }
/** * @param args * 解释一个Map.Entry */ public static void main(String[] args) { }}//创建接口interface Inter { //内部接口 interface Inter2 { public void show(); }}//实现接口中的内部接口方法class Demo implements Inter.Inter2 {//重写内部类接口方法 @Override public void show() { }
转载于:https://blog.51cto.com/357712148/2308109