### Question:
LayerSelectionUtilities { public static List<Object> filter(Collection<?> layers) { List<Object> filtered = New.list(layers); for (Object layer : layers) { if (layer instanceof DataGroupInfo) { DataGroupInfo group = (DataGroupInfo)layer; filtered.removeAll(group.getMembers(true)); filtered.removeAll(getAllChildren(group)); } } return filtered; } private  LayerSelectionUtilities(); static List<Object> filter(Collection<?> layers); static Collection<DataGroupInfo> getAllChildren(DataGroupInfo group);  }### Answer:
@Test public void testFilter() { DataGroupInfo a = createDataGroup("A"); DataGroupInfo b = createDataGroup("B"); DataTypeInfo c = createDataType("C"); DataTypeInfo d = createDataType("D"); DataGroupInfo e = createDataGroup("E"); DataTypeInfo f = createDataType("F"); DataTypeInfo g = createDataType("G"); a.addChild(b, this); b.addMember(c, this); b.addMember(d, this); a.addChild(e, this); a.addMember(f, this); a.addMember(g, this); List<?> input; List<?> expected; input = New.list(a, b, c, d, e, f, g); expected = New.list(a); Assert.assertEquals(expected, LayerSelectionUtilities.filter(input)); input = New.list(b, d); expected = New.list(b); Assert.assertEquals(expected, LayerSelectionUtilities.filter(input)); input = New.list(c, d, f, g); expected = New.list(c, d, f, g); Assert.assertEquals(expected, LayerSelectionUtilities.filter(input)); input = New.list(b, c, d, e, f, g); expected = New.list(b, e, f, g); Assert.assertEquals(expected, LayerSelectionUtilities.filter(input)); }