### Question:
ObjectList { public static Object remove(Object head, Object data){ if (head == null){ return null; } else if (data == null){ return head; } else { if (head instanceof Node){ Node nh = (Node)head; if (data.equals(nh.data)){ nh = nh.next; } else { Node n = nh; while (true) { Node nn = n.next; if (nn != null){ if (nn.data == data){ n.next = nn.next; break; } else { n = nn; } } else { break; } } } if (nh.next == null){ return nh.data; } else { return nh; } } else { if (data.equals(head)){ return null; } else { return head; } } } } private  ObjectList(); static Iterator iterator(Object head); static TypedIterator<A> typedIterator(Object head, Class<A> type); static Object createList(Object... values); static Object valueOf(Object o); static Object set(Object head, Object newHead); static Object forceSet(Object head, Object newHead); static Object add(Object head, Object data); static Object replace(Object head, Object oldData, Object newData); static Object remove(Object head, Object data); static boolean contains(Object head, Object o); static boolean containsType(Object head, Class<?> type); static boolean isList(Object head); static boolean isEmpty(Object head); static int size(Object head); static int numberOfInstances(Object head, Class<?> type); static Object get(Object head, int idx); static Object getFirst(Object head); static Object getNext(Object head, Object prevData); static A getFirst(Object head, Class<A> type); static A getNext(Object head, Class<A> type, Object prevData); static void hash(Object head, HashData hd); static boolean equals( Object head1, Object head2); static Object clone(Object head);  }### Answer:
@Test public void testRemove(){ attr = ObjectList.add(attr, "one"); attr = ObjectList.remove(attr, attr); assertTrue(attr == null); String one = "one"; String two = "two"; attr = ObjectList.add(attr, one); attr = ObjectList.add(attr, two); attr = ObjectList.remove( attr, one); assertTrue(attr != null && attr == two); attr = one; attr = ObjectList.add(attr, two); attr = ObjectList.remove( attr, two); assertTrue(attr != null && attr == one); attr = one; attr = ObjectList.add(attr, two); attr = ObjectList.add(attr, "three"); attr = ObjectList.remove( attr, two); int i=0; for (Object a: ObjectList.iterator(attr)){ System.out.printf("[%d] = %s\n", i++, a.toString()); } assertTrue( ObjectList.size(attr) == 2); }