@@ -0,0 +1,594 @@
+package org.amc.game;%0A%0A%0Aimport java.util.HashSet;%0Aimport java.util.Set;%0A%0Aimport org.amc.User;%0A/**%0A * A list of online users%0A * %0A * @author adrian%0A *%0A */%0Apublic final class OnlineUserList %7B%0A%09%0A%09private Set%3CUser%3E userSet;%0A%09%0A%09public OnlineUserList() %7B%0A%09%09userSet = new HashSet%3CUser%3E();%0A%09%7D%0A%09%0A%09public final void addUser(User user) %7B%0A%09%09synchronized (this) %7B%0A%09%09%09userSet.add(user);%0A%09%09%7D%0A%09%7D%0A%09%0A%09public final void removeUser(User user) %7B%0A%09%09synchronized (this) %7B%0A%09%09%09userSet.remove(user);%0A%09%09%7D%0A%09%7D%0A%09%0A%09public final boolean isOnline(User user) %7B%0A%09%09synchronized (this) %7B%0A%09%09%09return userSet.contains(user);%0A%09%09%7D%0A%09%7D%0A%0A%7D%0A

create OnLineUserList data structure