Is there a cleaner way than while (1) ... break;?
<p>This application matches two lists of words, one in a dictionary file, one that is generated by the application in a TreeSet. Maybe there are better ways to do this, but it's outside of the scope of this question - the way that we use is to read one line from the file, one line from the TreeSet, compare them and</p>

<p>save if the TreeSet line equals the file line</p>

<p>read a line from the file if the TreeSet line > file line</p>

<p>read a line from the TreeSet if the file line > TreeSet line</p>

<p>In pseudo code:</p>

<pre><code>while (1) {
    String dict = reader.readLine();
    if (dict == null || !TreeIterator.hasNext()) break;
    if (dict.equals(TreeIterator.next())...save
    elseif &gt; .... read tree
    elseif &lt; .... read file
}
</code></pre>

<p>It doesn't seem correct to use while (1), but I didn't find a cleaner way to express this double condition.
There is no way to read the two strings inside the while's condition, is there?
Is it possible to maintain the simplicity of this approach (no more clutter), while losing the strange while(1)?</p>

<p>Best regards.</p>
