title: What are parenthesis infront of an iterator variable in Java?
body: <pre><code>    for (Iterator i = guitars.iterator(); i.hasNext(); )
      {
          Guitar guitar = (Guitar)i.next();
          if (guitar.getSerialNumber().equals(serialNumber))
          {
              return guitar;
          }
      }
  </code></pre>
  
  <p>I cant understand what <strong><code>(Guitar)i.next()</code></strong> is doing. It looks as if <code>Guitar</code> was passed to a function <code>(...)</code> but I'm guessing and have no clue. Also not easy to formulate a search query for this kind of construct so please excuse possible duplicate question.</p>