Hi Stuart, In MapN.entrySet(), is the "int idx" being declared in the wrong place? It looks like it should be a field of the Iterator rather than the Set.
@Override public Set<Map.Entry<K,V>> entrySet() { return new AbstractSet<Map.Entry<K,V>>() { int idx = 0; // <------ this... @Override public int size() { return MapN.this.size; } @Override public Iterator<Map.Entry<K,V>> iterator() { // <---- ... should be here? return new Iterator<Map.Entry<K,V>>() { @Override public boolean hasNext() { Here's a test program that is not printing what I'd expect: Map<String, String> map = new MapN<>("a", "1", "b", "2", "c", "3"); Set<Map.Entry<String, String>> entrySet = map.entrySet(); Iterator<Map.Entry<String, String>> iterator = entrySet.iterator(); System.out.println(iterator.hasNext()); // true System.out.println(entrySet); // [c=3, b=2, a=1] System.out.println(iterator.hasNext()); // false System.out.println(entrySet); // [] -Michael On Thu, May 5, 2016 at 2:43 PM, Stuart Marks <stuart.ma...@oracle.com> wrote: > Hi all, > > Here's a revised webrev, incorporating some of the comments from Peter > Levart, Stephen Colebourne, and RĂ©mi Forax. > > http://cr.openjdk.java.net/~smarks/reviews/8139233/webrev.1/ > > I'd like to proceed with this changeset mostly as-is, and to allow > discussion of other issues (such as spec changes regarding iteration order) > to proceed asynchronously. > > Thanks, > > s'marks