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



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. very very thankssssssssssssssss
View Tutorial          By: gowtham at 2010-07-31 22:58:36

2. neded defination in clear
View Tutorial          By: venkat at 2011-07-04 06:31:19

3. i am try this codeing in vb . i am using nokia n73
View Tutorial          By: kanyaraj at 2010-02-09 19:10:10

4. Thks a lot..... The way of giving explanation and
View Tutorial          By: Hari at 2011-04-08 02:58:06

5. Its a nice article obviously. Can you put somethin
View Tutorial          By: kowser at 2009-10-06 23:44:52

6. Hi
Gr8 work......!!!!
thanks...!!!

View Tutorial          By: Antim Jain at 2010-07-12 23:44:14

7. Awesome information
View Tutorial          By: Pavan Somu @ Tech Tips at 2013-01-03 18:45:30

8. thank's
View Tutorial          By: gerald at 2010-08-06 01:21:39

9. Very good example .!
Ty

View Tutorial          By: Mprogrammer at 2014-11-25 12:10:21

10. Hi,
I can run this program.But after

View Tutorial          By: jayaraj at 2009-06-05 01:28:18