嵌套类引用实例化的外部类的方法

class:java.util.HashMap

line:814

HashMap.this.removeEntryForKey(k)

 1 public class HashMap<K,V>
2 extends AbstractMap<K,V>
3 implements Map<K,V>, Cloneable, Serializable
4 {
5 ...
6 final Entry<K,V> removeEntryForKey(Object key) {...}
7 private abstract class HashIterator<E> implements Iterator<E> {
8 Entry<K,V> next; // next entry to return
9 int expectedModCount; // For fast-fail
10 int index; // current slot
11 Entry<K,V> current; // current entry
12
13 HashIterator() {...}
14
15 public final boolean hasNext() {...}
16
17 final Entry<K,V> nextEntry() {...}
18
19 public void remove() {
20 if (current == null)
21 throw new IllegalStateException();
22 if (modCount != expectedModCount)
23 throw new ConcurrentModificationException();
24 Object k = current.key;
25 current = null;
26 HashMap.this.removeEntryForKey(k);
27 expectedModCount = modCount;
28 }
29 }
30 }



posted on 2011-10-21 16:49  大松  阅读(329)  评论(0编辑  收藏  举报