I recently ran into something like this...
public final class Foo<T>
implements Iterable<T> {
//...
public void remove(T t) { /* banana banana banana */ }
//...
public Iterator<T> Iterator {
return new Iterator<T>() {
//...
@Override
public void remove(T t) {
// here, 'this' references our anonymous class...
// 'remove' references this method...
// so how can we access Foo's remove method?
}
//...
};
}
}
Is there any way to do what I'm trying to while keeping this as an anonymous class? Or do we have to use an inner class or something else?