sory ale nie obczaic czemu wywala bład na petli for.
Prosze o porade.
private HashMap<String, Komputer> komputery = new HashMap<String, Komputer>();
for(Map<String,Komputer> entry : komputery.entrySet()){
System.out.println(entry.getKey()+" "+entry.getValue());
}
//for(Map.Entry entry: komputery.entrySet()){
//String id = (String) entry.getKey();
//Komputer komputery = (Komputer) entry.getValue();
// }
public void zarejestrujKomputer(Komputer k) {
k.zarejestrujKomputer(this);
komputery.put(k.getId(), k);
}
public void wyślij(String id, String wiadomość) {
komputery.get(id).odbierz(wiadomość);
}
}