@Test public void testIterator() throws Exception { Iterator<Coffee> it = coffees.iterator(); ArrayList<Coffee> coffees1 = new ArrayList<Coffee>(); while (it.hasNext()) { coffees1.add(it.next()); } Assert.assertEquals(10, coffees1.size()); }
@Override public Iterator<Coffee> iterator() { return new CoffeeIterator(); }
CoffeeGenerator implements Generator, Iterable<Coffee> { @Override public Iterator<Coffee> iterator() { return new CoffeeIterator(); } }
CoffeeGenerator implements Generator, Iterable<Coffee> { @Override public Iterator<Coffee> iterator() { return new CoffeeIterator(); } @SuppressWarnings("unused")  CoffeeGenerator();  CoffeeGenerator(int sz); }
CoffeeGenerator implements Generator, Iterable<Coffee> { @Override public Iterator<Coffee> iterator() { return new CoffeeIterator(); } @SuppressWarnings("unused")  CoffeeGenerator();  CoffeeGenerator(int sz); @Override Iterator<Coffee> iterator(); @Override Coffee next(); }
CoffeeGenerator implements Generator, Iterable<Coffee> { @Override public Iterator<Coffee> iterator() { return new CoffeeIterator(); } @SuppressWarnings("unused")  CoffeeGenerator();  CoffeeGenerator(int sz); @Override Iterator<Coffee> iterator(); @Override Coffee next();  }