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 / General / May 2006

Tip: Looking for answers? Try searching our database.

iterator does not return objects properly

Thread view: 
nooneinparticular314159@yahoo.com - 14 May 2006 23:29 GMT
Whenever I do:

Iterator KeyIterator = KeySet.iterator();
               while (KeyIterator.hasNext()){
                   Attack ReturnedAttack =  (Attack)
KeyIterator.next();

I get an error, either:
Exception in thread "main" java.lang.ClassCastException:
java.lang.String
       at geolocation.Main.main(Main.java:141)
The process tried to write to a nonexistent pipe.

or a no such object error, even though I can verify that there are
objects in the object being iterated on.

Any idea why?

Thanks!
Missaka Wijekoon - 15 May 2006 03:31 GMT
> Whenever I do:
>
[quoted text clipped - 15 lines]
>
> Thanks!

How about a little background?  What version of the JDK? Is it Sun's?
What OS?  How about a little code that can reproduce the problem?

-Missaka
Alun Harford - 15 May 2006 03:45 GMT
> Whenever I do:
>
[quoted text clipped - 6 lines]
> Exception in thread "main" java.lang.ClassCastException:
> java.lang.String

The Object in KeySet, that the iterator returns, is not of class Attack.

Alun Harford


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.