Skip to Main Content

New to Java

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

hashSet and iterator

francy77Sep 23 2014 — edited Sep 23 2014

Hi all,

I'm not new to java but i'm not able to solve the following issue:

I have  a class

public class Localizzazioni implements java.io.Serializable {

private <complexType>  id;

public getId().......

public setId().....

The complexType is a class defined in the code somewhere.

now i want to access it in another class i have

Set localizzazioni = new HashSet(0);

localizzazioni=opere.getOiLocalizzazioneOperas();    -- this object give an object of tyoe HashSet

for(Object object : localizzazioni) {

  object.get.........     // i cannot use any method defined in the class Localizzazioni

  }

Why i cannot write inside the for

object.getId() and using it??

in other word how i can access the element containted in the object?? the object is an iterator of type Localizzazioni . The class Localizzazioni  has some method but i cannot use them? why

Thanks really much

Francesco

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Oct 21 2014
Added on Sep 23 2014
2 comments
1,013 views