title: How to store object inside Iterator<object>?
body: <p>So I have a variable string and I want to store it inside an Iterator of type string, but I keep getting an error stating that it is incompatible types. How can I store a string variable inside an iterator?</p>
  
  <pre><code>Incompatible Types:
  Required: java.util.Iterator &lt;java.lang.String&gt;
  Found: java.lang.String
  </code></pre>
  
  <p>This is what I've done so far:</p>
  
  <pre><code>Iterator&lt;?&gt; perEntry = entries.iterator();
  Iterator&lt;String&gt; ids;
  while (perEntry.hasNext()) {
      ids = perEntry.next().getId();
  }
  </code></pre>
  
  <p>Any help would be appreciated thank you!</p>
  
  <p>P.S. I forgot to include this, but how do I return this Iterator? I get an error stating that it found java.util.ObjectType, and it requires java.util.Iterator.</p>