title: How can I make my class iterable so I can use foreach syntax?
body: <p>I have <code>Book</code> and <code>BookList</code> classes. <code>BookList</code> is something like this:</p>
  <pre><code>public class BookList 
  {
      private final List&lt;Book&gt; bList = new ArrayList&lt;Book&gt;();
  
      public int size() { return bList.size(); }
  
      public boolean isEmpty() {  ... }
  
      public boolean contains(Book b) { ...  }
  
      public boolean add(Book b) { ...  }
  
      public boolean remove(Book b) {  .. } 
  
      public void clear() { ... }
  
      public Book get(int index) { ... }
   
  }
  </code></pre>
  <p>In my main class I want to print titles of books with in a for each loop:</p>
  <pre><code>for(Book b : bList)
  {
      b.print();
  }
  </code></pre>
  <p>Eclipse says:</p>
  <blockquote>
  <p>Can only iterate over an array or an instance of java.lang.Iterable</p>
  </blockquote>
  <p>How can I get this working?</p>