@Test public void testGetFirstItem() { List<String> strings = Arrays.asList("a", "b", "c", "d", "e", "f"); ListHead<String> head = ListHead.fromCollection(strings); assertEquals("a", head.getFirstItem()); head.clear(); assertTrue(head.isEmpty()); assertNull(head.getFirstItem()); }
public T getFirstItem() { return !isEmpty() ? first.item : null; }
ListHead implements Iterable<T> { public T getFirstItem() { return !isEmpty() ? first.item : null; } }
ListHead implements Iterable<T> { public T getFirstItem() { return !isEmpty() ? first.item : null; } private  ListHead(); private  ListHead(ListHead<T> other); }
ListHead implements Iterable<T> { public T getFirstItem() { return !isEmpty() ? first.item : null; } private  ListHead(); private  ListHead(ListHead<T> other); static ListHead<T> newInstance(); static ListHead<T> newInstance(ListHead<T> other); boolean isEmpty(); void clear(); T getFirstItem(); int size(); ListItem<T> find(Object value); boolean contains(Object value); ListItem<T> push(T value); T pop(); List<T> toList(); static ListHead<T> fromCollection(Collection<T> collection); @Override Iterator<T> iterator(); @Override String toString(); }
ListHead implements Iterable<T> { public T getFirstItem() { return !isEmpty() ? first.item : null; } private  ListHead(); private  ListHead(ListHead<T> other); static ListHead<T> newInstance(); static ListHead<T> newInstance(ListHead<T> other); boolean isEmpty(); void clear(); T getFirstItem(); int size(); ListItem<T> find(Object value); boolean contains(Object value); ListItem<T> push(T value); T pop(); List<T> toList(); static ListHead<T> fromCollection(Collection<T> collection); @Override Iterator<T> iterator(); @Override String toString(); public ListItem<T> first; }