@@ -0,0 +1,1618 @@
+package com.hitthebits.hacknslash;%0A%0Aimport org.junit.Before;%0Aimport org.junit.Test;%0Aimport java.util.ConcurrentModificationException;%0Aimport java.util.Iterator;%0Aimport java.util.List;%0A%0Aimport static org.junit.Assert.assertEquals;%0A%0Apublic class ListRemoveIfTest %7B%0A    List%3CPlayer%3E players;%0A%0A    @Before%0A    public void setup() %7B%0A        players = Factory.createPlayers();%0A        applySomeDamage();%0A    %7D%0A%0A    private void applySomeDamage() %7B%0A        players.get(0).decreaseHealth(101);%0A        players.get(1).decreaseHealth(50);%0A        players.get(2).decreaseHealth(160);%0A        players.get(3).decreaseHealth(20);%0A        players.get(4).decreaseHealth(40);%0A    %7D%0A%0A    @Test(expected = ConcurrentModificationException.class)%0A    public void java7Approach_enhancedForLoop() %7B%0A        for (Player player : players) %7B%0A            if (player.isDead()) %7B%0A                players.remove(player);%0A            %7D%0A        %7D%0A    %7D%0A%0A    @Test%0A    public void java7Approach_iterator() %7B%0A        Iterator%3CPlayer%3E iterator = players.iterator();%0A        while (iterator.hasNext()) %7B%0A            if (iterator.next().isDead()) %7B%0A                iterator.remove();%0A            %7D%0A        %7D%0A        assertEquals(3, players.size());%0A    %7D%0A%0A    @Test%0A    public void java7Approach_reverseIndex() %7B%0A        for (int i = players.size() - 1; i %3E= 0; i--) %7B%0A            if (players.get(i).isDead()) %7B%0A                players.remove(i);%0A            %7D%0A        %7D%0A        assertEquals(3, players.size());%0A    %7D%0A%0A    @Test%0A    public void java8Approach() %7B%0A        players.removeIf(p -%3E p.isDead());%0A        assertEquals(3, players.size());%0A    %7D%0A%7D%0A

Add ListRemoveIfTest