Iterator<String> () { try { doStuff(); } catch (SQLException ex) { handleEx(ex); return new Iterator<String>() { public boolean hasNext() { return false; } public String next() { throw new NoSuchElementException(); } public void remove() { throw new UnsupportedOperationException(); } }; } return null; }