title: Iterable and Iterator in java
body: <p>Here is my understanding on significance of using <code>Iterable</code> and <code>Iterator</code> in pre 1.8 java.</p>
  
  <p>1)</p>
  
  <p><code>java.util.AbstractList</code> is <code>Iterable</code> because it implements,</p>
  
  <p><code>Iterator&lt;T&gt; iterator();</code>, which is a contract for any class to be <code>Iterable</code>.</p>
  
  <p>2)</p>
  
  <p><code>java.util.AbstractList</code> implements,</p>
  
  <p><code>Iterator&lt;T&gt; iterator();</code> by creating an instance level inner class,</p>
  
  <pre><code>private class Itr implements Iterator&lt;E&gt; { ... }
  </code></pre>
  
  <p>that implements <code>hasNext</code>, <code>next</code> and <code>remove</code> methods.</p>
  
  <p><code>private class ListItr extends Itr implements ListIterator&lt;E&gt;{..}</code> is just an extra facility over above iterator for <code>List</code> type implementations.</p>
  
  <p>3)</p>
  
  <p>Is this the only purpose of these two interfaces <code>Iterable</code> &amp; <code>Iterator</code>, to  enable any object to be iterable? Please let me know, if there is any other purpose of these two interfaces?</p>