> Just a guess. Assign next() to an object. For example:
> Object elem=li.next();
> if(elem.getClass().getName().equals("java.lang.String"){ ..
Silly me. Bad suggestion. Will not work.
I came across instanceof. It checks if an object is an instance of a
certain class. If I can reproduce correctly, usage is like such:
Object elem=li.next();
if(elem instanceof String{
String stringElement=(String)elem;
// Continue.
}else{
// Not a string.
}
--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/javaprogrammingwithpassion?hl=en
-~----------~----~----~----~------~----~------~--~---