Hi, I'm making an app that uses Collections.
Everything went ok until now, what I've done:
I've got a class that initializes 3 strings, those strings are private, so I have made 6 public functions that sets or reads values from those strings.
Next I've made a hashmap, keys are generated as strings made by merging values from those 3 strings of a class and the values are objects of the first class.
Now'm stuck when I've got to iterate/access to those 3 Strings by reading them from map.
By entryset() and values() I could get what? I need access to those public functions that reads values of class Strings separately and set their values to other Strings.
I can't make it so:
class Objects {
String string1;
String string2;
String string3;
public getString1(){
return string1;
}
//etc....
}
...
class showAll {
Set entries = data.entrySet(); //where data is actual hashmap
Iterator it = entries.iterator();
while(it.hasNext()) {
Map.Entry entry = (Map.Entry) it.next();
String surname = iterator.next().getString1(); //IT DOESN'T WORK, how to achieve this?
System.out.println(surname);
}
}
...
It's not an actual code, it's just a draft.
Please for help.