DeclarationParser { static <T> List<T> removeNulls(List<T> list) { for (Iterator<?> it = list.iterator(); it.hasNext();) { if (it.next() == null) { it.remove(); } } return list; }  static Parser<Program> program(); static Program parse(String source); static Program parse(URL url);  }
@Test public void testRemoveNulls() { List<?> list = new ArrayList<String>(Arrays.asList("a", "b", null, "1", "2", null)); DeclarationParser.removeNulls(list); assertEquals(Arrays.asList("a", "b", "1", "2"), list); }