title: How to implement ListIterator?
body: <p>I created this extension of ArrayList, NullIgnoringArrayList, because it's possible that my application will add nulls from time to time. I know there are various other ways to deal with this, like checking for null before inserting or filtering out nulls when accessing the ArrayList. But I got it in my head to do it this way and it was going fine but now I don't know how to proceed.</p>
  
  <p>I should implement ListIterator because my tests call upon this method. I peaked in the implementation inside ArrayList but there ListItr is a private class that uses the private fields of ArrayList, which I don't have in NullIgnoringArrayList.</p>
  
  <p>To be fair though, I might be overengineering and maybe I should just drop it. On the other hand, one might learn a thing or two.</p>
  
  <p>NullIgnoringArrayList:</p>
  
  <pre><code>public class NullIgnoringArrayList&lt;T&gt; extends ArrayList&lt;T&gt; {
  
      @Override
      public boolean add(T element) {
          return !isNull(element) &amp;&amp; super.add(element);
      }
  
      @Override
      public void add(int index, T element) {
          if (isNull(element)) {
              return;
          }
          super.add(index, element);
      }
  
      @Override
      public boolean addAll(Collection c) {
          return !isNull(c) &amp;&amp; super.addAll(c);
      }
  
      @Override
      public boolean addAll(int index, Collection c) {
          return !isNull(c) &amp;&amp; super.addAll(index, c);
      }
  
      @Override
      public ListIterator listIterator() {
          throw new NotImplementedException();
      }
  
      @Override
      public ListIterator listIterator(int index) {
          throw new NotImplementedException();
      }
  }
  </code></pre>
  
  <p>SimpleListIterator:</p>
  
  <pre><code>public class SimpleListIterator&lt;T&gt; implements ListIterator {
      @Override
      public boolean hasNext() {
          return false;
      }
  
      @Override
      public Object next() {
          return null;
      }
  
      @Override
      public boolean hasPrevious() {
          return false;
      }
  
      @Override
      public Object previous() {
          return null;
      }
  
      @Override
      public int nextIndex() {
          return 0;
      }
  
      @Override
      public int previousIndex() {
          return 0;
      }
  
      @Override
      public void remove() {
  
      }
  
      @Override
      public void set(Object o) {
  
      }
  
      @Override
      public void add(Object o) {
  
      }
  }
  </code></pre>