(java) incompatable types?
<p>I'm getting an error: 'incompatible types - found unit but expected unit' in compilation. Why is this?
This is when returning from a method, I can even parse the returning data into 'unit' and it works fine, why is this error occurring?
Does the fact that I am using an iterator within a collection I have made have anything to do with it? I haven't left the iterator type E as I specifically want this collection for one type of object.</p>

<pre><code>private class unitHashIterator&lt;unit&gt; implements Iterator&lt;unit&gt; {
  private unitHash hash;
  private int nextIndex;
  private unitHashIterator(unitHash u) {
    hash = u; nextIndex = 0;
  }
  public unit next() {
    if(!hasNext())
      throw new NoSuchElementException();
    return hash.data[nextIndex++]; &lt;&lt; HERE OCCURS THE ERROR
  }
}
</code></pre>

<p>This class is contained within a collection. 'incompatible types - found unit but expected unit' </p>
