How to get values from inner object in the hashmap in java? -


i have hashmap. object contains info name, address, email. able iterate hashmap not able values object. here code if can please show me proper way this.

public void getdata(){      // hashmap records<key, object>     // object contains properties name, address, email      iterator = records.entryset().iterator();     while(it.hasnext()){         map.entry entry = (map.entry) it.next();          object key =  entry.getkey();         object val =  entry.getvalue();          // gets me through hashmap         // how name, address , email object?      }  } 

since not using generics, need explicitly cast result of entry.getvalue() class of object name, address, , email.

you didn't provide actual class, might like:

    person val =  person.class.cast(entry.getvalue());     name = val.getname();     // , on.... 

Comments

Popular posts from this blog

SPSS keyboard combination alters encoding -

Add new record to the table by click on the button in Microsoft Access -

CSS3 Transition to highlight new elements created in JQuery -