Getting an error with a sublist
<p>I'm making a 4-player team game and was asked to use a sublist. Here are the lists:</p>

<pre><code>/**
 * The list of players in this team.
 */
private final static List&lt;Player&gt; players = new LinkedList&lt;Player&gt;();

/**
 * A list of players in the waiting room.
 */
private final static List&lt;Player&gt; waitingPlayers = new LinkedList&lt;Player&gt;();
</code></pre>

<p>I'm getting this error:</p>

<pre><code>java.util.ConcurrentModificationException
[11/25/11 3:36 PM]:     at java.util.SubList.checkForComodification(Unknown Sour
ce)
[11/25/11 3:36 PM]:     at java.util.SubList.listIterator(Unknown Source)
[11/25/11 3:36 PM]:     at java.util.AbstractList.listIterator(Unknown Source)
[11/25/11 3:36 PM]:     at java.util.SubList.iterator(Unknown Source)
[11/25/11 3:36 PM]:     at java.util.AbstractCollection.contains(Unknown Source)

[11/25/11 3:36 PM]:     at java.util.AbstractCollection.removeAll(Unknown Source)
</code></pre>

<p>code listed here.</p>

<pre><code>public static void enterGame(final Client c) {      
    if(waitingPlayers.size() &lt; 4) {
        c.sendMessage("Waiting for 4 players");
        return; // not enough players
    }
    // Picks 4 ppl from the list
    System.out.println("Starting new game");
    Collections.shuffle(waitingPlayers);
    System.out.println("Picking random players");
    final List&lt;Player&gt; picked = waitingPlayers.subList(0, 4); 
    players.addAll(picked);
    waitingPlayers.removeAll(picked);
    if(players.contains(c)) {
        c.sendMessage("Your on a team!");
    }
}
</code></pre>
