package ethanjones.modularworld.networking.server;

import com.badlogic.gdx.net.Socket;
import ethanjones.modularworld.core.logging.Log;
import ethanjones.modularworld.networking.common.Networking;
import ethanjones.modularworld.networking.common.packet.Packet;
import ethanjones.modularworld.networking.common.socket.SocketMonitor;

import java.util.HashMap;

public class ServerNetworking extends Networking {

  private HashMap<Socket, SocketMonitor> sockets;
  private SocketMonitorServer serverSocketMonitor;

  public ServerNetworking(int port) {
    super(port);
  }

  public void start() {
    Log.info("Starting Server Networking");
    sockets = new HashMap<Socket, SocketMonitor>();
    serverSocketMonitor = new SocketMonitorServer(port);
    serverSocketMonitor.start();
  }

  @Override
  public void stop() {
    Log.info("Stopping Server Networking");
    serverSocketMonitor.dispose();
    for (SocketMonitor socketMonitor : sockets.values()) {
      socketMonitor.dispose();
    }
  }

  protected synchronized void accepted(Socket socket) {
    sockets.put(socket, new SocketMonitor(socket, this));
    Log.info("Successfully connected to " + socket.getRemoteAddress());
  }

  @Override
  public void received(Packet packet, SocketMonitor socketMonitor) {

  }

  @Override
  public void disconnected(SocketMonitor socketMonitor, Exception e) {
    super.disconnected(socketMonitor, e);
    sockets.remove(socketMonitor.getSocket());
  }
}

@@ -77,24 +77,61 @@
 net.Socket;%0A
+import com.badlogic.gdx.utils.Array;%0A
 import ethan
@@ -167,16 +167,16 @@
 ng.Log;%0A
-
 import e
@@ -368,35 +368,8 @@
 r;%0A%0A
-import java.util.HashMap;%0A%0A
 publ
@@ -426,32 +426,22 @@
 private 
-HashMap%3CSocket, 
+Array%3C
 SocketMo
@@ -658,24 +658,14 @@
 new 
-HashMap%3CSocket, 
+Array%3C
 Sock
@@ -937,17 +937,8 @@
 kets
-.values()
 ) %7B%0A
@@ -1051,20 +1051,12 @@
 ets.
-put(socket, 
+add(
 new 
@@ -1392,16 +1392,21 @@
 s.remove
+Value
 (socketM
@@ -1415,20 +1415,14 @@
 itor
-.getSocket()
+, true
 );%0A 

Use array instead of hashmap in Server Networking