, Java , . ?
. ; , Java . (hosts, immune infectious), .
"" , ; a HashSet .
private HashSet<Host> hosts;
private HashSet<Host> immune;
private HashSet<Host> infectious;
public void killHost(Host deadManWalking) {
hosts.remove(deadManWalking);
immune.remove(deadManWalking);
infectious.remove(deadManWalking);
}
O (lg n) . ( equals hashCode Host, .)
++ , - ; ++ , . ++ ? , , , , Java rep ; . ? , , , , . ++ Java , ++. , Java, , . YMMV, natch, .