### Question:
TransitiveGroup { static void reduceTransitive(Collection<GroupTransition> transitive) { final Collection<GroupTransition> localChecked = new ArrayList<>(transitive.size()); final Collection<GroupTransition> toRemove = new ArrayList<>(); final Iterator<GroupTransition> iterator = transitive.iterator(); GroupTransition first = iterator.next(); while (iterator.hasNext()) { final GroupTransition current = iterator.next(); localChecked.add(current); if (current.getOut().equals(first.getOut())) { toRemove.addAll(localChecked); localChecked.clear(); if (iterator.hasNext()) { first = iterator.next(); } } } transitive.removeAll(toRemove); toRemove.clear(); } TransitiveGroup(MapTile map); void load(); void checkTransitives(Tile tile); Collection<GroupTransition> getTransitives(String groupIn, String groupOut); Collection<Integer> getDirectTransitiveTiles(Transition transition);  }### Answer:
@Test void testReduce() { final Collection<GroupTransition> transitive = new ArrayList<>(); transitive.add(new GroupTransition("a", "b")); transitive.add(new GroupTransition("b", "c")); transitive.add(new GroupTransition("c", "b")); transitive.add(new GroupTransition("b", "d")); final Collection<GroupTransition> expected = new ArrayList<>(); expected.add(new GroupTransition("a", "b")); expected.add(new GroupTransition("b", "d")); TransitiveGroup.reduceTransitive(transitive); assertEquals(expected, transitive); }