Question regarding foreach loop...
Hey everyone, I'm kind of stuck in this foreach loop. heres my code:
private Map<String, Person> record;
public Group()
{
record - new TreeMap<String, Person>();
}
public Group(Group group)
{
record = new TreeMap<String, Person>();
for (Person person : group.record)
{
this.record.put(person.getName(), person);
}
}
Now as I understand the foreach loop...
its taking all the elements that are in group.record and assigning them one by one to person. then im putting (person.getName(), and the actual object person into this.record.... however i keep getting the error "foreach not applicable to expression type" and its pointing at "group.record" in the foreach loop statement.
i am really stuck with this... can someone please help me!! thankyou so much in advance.
Shawn