Iterator<V> () { return new Iterator<>() { private final Iterator<T> subClassIterator = subClasses.iterator(); // guarded by lock { synchronized (lock) { subClassIterator.next(); //skip the baseClass which stored in the subClasses first element } } @Override public boolean hasNext() { synchronized (lock) { if (subClassIterator.hasNext()) return true; } processMoreSubclasses(subClassIterator); synchronized (lock) { return subClassIterator.hasNext(); } } @Override public V next() { T next; synchronized (lock) { next = subClassIterator.next(); } return myAnchorToValueConvertor.apply(next); } }; }