inner-inner class referencing outer class's inherited method
- From: Murat Tasan <murat.tasan@xxxxxxxx>
- Date: Thu, 28 Apr 2005 16:49:00 -0400
i have a class called NonRepeatedDefaultMatrix
NonRepeatedDefaultMatrix has an inner class KeySet<E>
KeySet<E> inherits from HashSet<E>
KeySet<E> has an inner class KeySetIterator<E>
so, the inner-outer class tree looks like:
NonRepeatedDefaultMatrix
KeySet<E> inherits HashSet<E>
KeySetIterator<E>
note that these are inner classes, not static nested class
now the problem:
in a method in KeySetIterator i have a line where i am attempting to get a
reference to the iterator returned by HashSet's iterator method.
thus, if the line was written in a method in KeySet i would simply write:
Iterator<E> theIterator = super.iterator();
which works fine.
the equivalent line i write in a method in KeySetIterator is:
Iterator<E> theIterator = NonRepeatedDefaultMatrix.KeySet.super.iterator();
the error I get during compilation:
sourcepath/NonRepeatedDefaultMatrix.java:364: incompatible types
found : java.util.Iterator<E>
required: java.util.Iterator<E>
this.theIterator = NonRepeatedDefaultMatrix.KeySet.super.iterator();
obviously this error message is misleading as the types are most certainly
compatible!
i want the line to get the iterator returned by the HashSet's iterator()
implementation, not the KeySet's iterator() implementation.
this is necessary because the line in question is part of the
KeySetIterator's constructor, which is called by KeySet.iterator() - which
would obviously result in calling cycle.
anyone out there still managing to read this far down understand my
problem?
better yet... anyone know how i should do this?
thanks much!
murat
.
- Follow-Ups:
- Re: inner-inner class referencing outer class's inherited method
- From: Murat Tasan
- Re: inner-inner class referencing outer class's inherited method
- Prev by Date: Re: Java Swing
- Next by Date: Re: inner-inner class referencing outer class's inherited method
- Previous by thread: Re: Java Swing
- Next by thread: Re: inner-inner class referencing outer class's inherited method
- Index(es):
Relevant Pages
|