Goal: Understand how changes made to a map's entrySet simultaneously change the underlying map itself.
Reason: Bruce Eckel - Thinking in Java 3rd Ed. - p 579-580 - ex 34-37
Author creates a "SlowMap" extension to AbstractMap which is (initially) based on 2 ArrayLists: keys and values. Author starts with entrySet() method that returns HashSet of key/value pairs. Since this HashSet is not "backed" by the SlowMap, changes made via HashSet.iterator() et al are not reflected in SlowMap.
Challenge: As elegantly as possible, alter SlowMap so that SlowMap.entrySet() returns set that IS backed by the SlowMap.
Problem: Tried to examine \java\util\*.* source code via my installation's ..\j2sdk1.4.2\src.zip. Examined Map.java, AbstractMap.java, and HashMap.java, and became confused.
Request: 1. Am I examining the appropriate source code files? 2. Easier to meet challenge if I could find/understand the specific source code that allows entrySet.Iterator() changes to simultaneously affect underlying map. 3. Nice if also got sample code or url ref to sample. Perhaps not uncommon to extend AbstractMap for customized Map.