Nested for-loops with Iterators?
<p>I have the following code which uses nested for-each loops to traverse two ArrayList properties in the Job class and the Category class (as well as performing a little logic on the properties):</p>

<pre><code>for(Object dobj : hospice.getCategorys()) {
    Category cat = (Category) dobj;
    for(Object pobj : cat.getJobs()) {
        Job job = (Job) pobj;

        if(job.getID() == id) {
            System.out.println(
                String.format("The Job %d belongs to the (%s) %s Category.", 
                              id, 
                              cat.getCode(), 
                              cat.getName()));

            catFound = true;
        }

    }
}
</code></pre>

<p>Is there anyway to make use of Java Iterators with this approach to create a more elegant and future-proof solution?</p>

<p>Thanks.</p>
