/** Called when it's time to clean up disconnected Connection objects */ void clearDisconnected() { for (int i = connections.size() - 1; i >= 0; i--) { GsmConnection cn = (GsmConnection) connections.get(i); if (cn.getState() == State.DISCONNECTED) { connections.remove(i); } } if (connections.size() == 0) { state = State.IDLE; } }