Comment on Tutorial - How to use Iterator in Java By Fazal



Comment Added by : Steve

Comment Added at : 2012-01-18 15:58:31

Comment on Tutorial : How to use Iterator in Java By Fazal
I would like to know how to obtain the object that the Iterator is actually referencing. Not all ArrayLists will be storing Strings, and no matter what I do I cannot obtain the object being referenced by that iterator.

For example, if my ArrayList is storing MyClass objects I want to do something like this:

Iterator iter = theArrayList.iterator();
MyClass current = (MyClass)iter; // <--- What do I do here?


View Tutorial



Ask a Question

Subscribe to Tutorials

Related Tutorials

Program using concept of byte long short and int in java

Update contents of a file within a jar file

Tomcat and httpd configured in port 8080 and 80

Java File

Java String

Count number of vowels, consonants and digits in a String in Java

Reverse a number in Java

Student marks calculation program in Java

Handling Fractions in Java

Calculate gross salary in Java

Calculate average sale of the week in Java

Vector in Java - Sample Program

MultiLevel Inheritance sample in Java

Multiple Inheritance sample in Java

Java program using Method Overriding

Archived Comments

1. the above is perfect, but when i hit the export bu
View Tutorial          By: CH at 2009-06-02 03:01:34

2. @Iqra :

You're welcome. Use sites l

View Tutorial          By: Macho Man at 2012-07-16 08:02:14

3. To "need help":

String s

View Tutorial          By: Mike at 2010-10-14 20:09:31

4. outstanding....
View Tutorial          By: subhasish biswas at 2009-04-19 00:16:50

5. Does your Siemens CX75 can show up as COM port dev
View Tutorial          By: mchon at 2008-10-10 18:24:11

6. It was really helpful.... i cleared my lab test wi
View Tutorial          By: kishore at 2009-01-21 22:30:08

7. thats good
View Tutorial          By: P.Kumar at 2009-08-02 10:48:48

8. Nice explanation. And a good example to back it up
View Tutorial          By: fazil at 2009-07-29 00:32:03

9. But I have the same error ("javax.net.ssl.SSL
View Tutorial          By: azeemuddin at 2010-03-04 07:25:33

10. This program is mush faster and finer than given p
View Tutorial          By: Anonymous at 2013-02-27 05:38:27