Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / First Aid / April 2005

Tip: Looking for answers? Try searching our database.

inner-inner class referencing outer class's inherited method

Thread view: 
Murat Tasan - 28 Apr 2005 21:49 GMT
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
Murat Tasan - 29 Apr 2005 00:10 GMT
well - i figured out a better way around the problem.  thanks anyhow.

> i have a class called NonRepeatedDefaultMatrix
>
[quoted text clipped - 51 lines]
>
> murat


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.