### Question:
StringStack implements Iterable<String> { public Iterator<String> iterator() { return new StringListIterator(this); } StringStack(String... xs);  StringStack(Iterable<String> xs); int size(); boolean isEmpty(); boolean contains(String o); boolean add(String e); void clear(); String get(int index); int indexOf(String o); Iterator<String> iterator();  }### Answer:
@Test public void testIterator() { StringStack ss = new StringStack("moo", "far"); Iterator<String> iters = ss.iterator(); assertTrue(iters.hasNext()); assertEquals("moo", iters.next()); assertTrue(iters.hasNext()); assertEquals("far", iters.next()); assertFalse(iters.hasNext()); iters = ss.iterator(); assertTrue(iters.hasNext()); assertEquals("moo", iters.next()); assertTrue(iters.hasNext()); assertEquals("far", iters.next()); assertFalse(iters.hasNext()); }