| 3 | import java.util.List; |
| 4 | |
| 5 | public class BookIterator implements Iterator{ |
| 6 | private List<Book> books; |
| 7 | private int index = 0; |
| 8 | |
| 9 | public BookIterator(List<Book> books){ |
| 10 | this.books = books; |
| 11 | } |
| 12 | |
| 13 | |
| 14 | @Override |
| 15 | public boolean hasNext() { |
| 16 | return index < books.size(); |
| 17 | } |
| 18 | |
| 19 | @Override |
| 20 | public Object next() { |
| 21 | if (this.hasNext()){ |
| 22 | return books.get(index++); |
| 23 | } |
| 24 | return null; |
| 25 | } |
| 26 | } |
nothing calls this directly
no outgoing calls
no test coverage detected