Correct way to return a single result where multiple results may exist
<p>In the following code, the <code>ssNo</code> parameter should ensure that only a single <code>Employee</code> satisfies the query condition:</p>

<pre><code>Employee employee = null;
List&lt;Employee&gt; results = (List&lt;Employee&gt;) query.execute(ssNo);
if (results.iterator().hasNext())
{
    for (Employee r : results)
    {
        employee = r;
    }
}
return employee;
</code></pre>

<p>But if there are multiple results, the <code>for</code> loop ensures that the last <code>Employee</code> in the loop will be returned:</p>

<pre><code>for (Employee r : results)
{
    employee = r;
}
</code></pre>

<p>Is there a cleaner way to perform this kind of check?</p>
