/** * Checks whether the underlying Iteration contains more elements. * * @return <tt>true</tt> if the underlying Iteration contains more elements, <tt>false</tt> otherwise. * @throws X */ @Override public boolean hasNext() throws X { if (isClosed()) { return false; } try { boolean result = iter.hasNext(); if(!result) { close(); } return result; } catch (Exception e) { throw convert(e); } }
/** * Calls <tt>remove()</tt> on the underlying Iteration. * * @throws UnsupportedOperationException * If the wrapped Iteration does not support the <tt>remove</tt> operation. * @throws IllegalStateException * If the Iteration has been closed, or if {@link #next} has not yet been called, or * {@link #remove} has already been called after the last call to {@link #next}. */ @Override public void remove() throws X { if (isClosed()) { throw new IllegalStateException("The iteration has been closed."); } try { iter.remove(); } catch (UnsupportedOperationException e) { throw e; } catch (IllegalStateException e) { throw e; } catch (Exception e) { throw convert(e); } }
try { if (result != null) { result.close();
/** * Closes this Iteration as well as the wrapped Iteration if it happens to be a {@link CloseableIteration} * . */ @Override protected void handleClose() throws X { try { super.handleClose(); } finally { try { Iterations.closeCloseable(iter); } catch (Exception e) { throw convert(e); } } } }
/** * Calls <tt>remove()</tt> on the underlying Iteration. * * @throws UnsupportedOperationException * If the wrapped Iteration does not support the <tt>remove</tt> operation. * @throws IllegalStateException * If the Iteration has been closed, or if {@link #next} has not yet been called, or * {@link #remove} has already been called after the last call to {@link #next}. */ @Override public void remove() throws X { if (isClosed()) { throw new IllegalStateException("The iteration has been closed."); } try { iter.remove(); } catch (UnsupportedOperationException e) { throw e; } catch (IllegalStateException e) { throw e; } catch (Exception e) { throw convert(e); } }
try { if (result != null) { result.close();
/** * Closes this Iteration as well as the wrapped Iteration if it happens to be a {@link CloseableIteration} * . */ @Override protected void handleClose() throws X { try { super.handleClose(); } finally { try { Iterations.closeCloseable(iter); } catch (Exception e) { throw convert(e); } } } }
/** * Checks whether the underlying Iteration contains more elements. * * @return <tt>true</tt> if the underlying Iteration contains more elements, <tt>false</tt> otherwise. * @throws X */ @Override public boolean hasNext() throws X { if (isClosed()) { return false; } try { boolean result = iter.hasNext(); if(!result) { close(); } return result; } catch (Exception e) { throw convert(e); } }
/** * Calls <tt>remove()</tt> on the underlying Iteration. * * @throws UnsupportedOperationException * If the wrapped Iteration does not support the <tt>remove</tt> operation. * @throws IllegalStateException * If the Iteration has been closed, or if {@link #next} has not yet been called, or * {@link #remove} has already been called after the last call to {@link #next}. */ @Override public void remove() throws X { if (isClosed()) { throw new IllegalStateException("The iteration has been closed."); } try { iter.remove(); } catch (UnsupportedOperationException e) { throw e; } catch (IllegalStateException e) { throw e; } catch (Exception e) { throw convert(e); } }
/** * Closes this Iteration as well as the wrapped Iteration if it happens to be a {@link CloseableIteration} * . */ @Override protected void handleClose() throws X { try { super.handleClose(); } finally { try { Iterations.closeCloseable(iter); } catch (Exception e) { throw convert(e); } } } }
/** * Checks whether the underlying Iteration contains more elements. * * @return <tt>true</tt> if the underlying Iteration contains more elements, <tt>false</tt> otherwise. * @throws X */ @Override public boolean hasNext() throws X { if (isClosed()) { return false; } try { boolean result = iter.hasNext(); if(!result) { close(); } return result; } catch (Exception e) { throw convert(e); } }
/** * Returns the next element from the wrapped Iteration. * * @throws X * @throws java.util.NoSuchElementException * If all elements have been returned. * @throws IllegalStateException * If the Iteration has been closed. */ @Override public E next() throws X { if (isClosed()) { throw new NoSuchElementException("The iteration has been closed."); } try { return iter.next(); } catch (NoSuchElementException e) { close(); throw e; } catch (IllegalStateException e) { throw e; } catch (Exception e) { throw convert(e); } }
/** * Returns the next element from the wrapped Iteration. * * @throws X * @throws java.util.NoSuchElementException * If all elements have been returned. * @throws IllegalStateException * If the Iteration has been closed. */ @Override public E next() throws X { if (isClosed()) { throw new NoSuchElementException("The iteration has been closed."); } try { return iter.next(); } catch (NoSuchElementException e) { close(); throw e; } catch (IllegalStateException e) { throw e; } catch (Exception e) { throw convert(e); } }
/** * Returns the next element from the wrapped Iteration. * * @throws X * @throws java.util.NoSuchElementException * If all elements have been returned. * @throws IllegalStateException * If the Iteration has been closed. */ @Override public E next() throws X { if (isClosed()) { throw new NoSuchElementException("The iteration has been closed."); } try { return iter.next(); } catch (NoSuchElementException e) { close(); throw e; } catch (IllegalStateException e) { throw e; } catch (Exception e) { throw convert(e); } }