/** * Checks whether the source type iteration contains more elements. * * @return <tt>true</tt> if the source type iteration contains more elements, <tt>false</tt> otherwise. * @throws X */ @Override public boolean hasNext() throws X { if (isClosed()) { return false; } boolean result = iter.hasNext(); if (!result) { close(); } return result; }
/** * Returns the next element from the source type iteration. * * @throws X * @throws java.util.NoSuchElementException * If all elements have been returned. * @throws IllegalStateException * If the iteration has been closed. */ @Override public T next() throws X { if (isClosed()) { throw new NoSuchElementException("The iteration has been closed."); } return convert(iter.next()); }
try { if (result != null) { result.close();
/** * 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."); } iter.remove(); }
try { if (result != null) { result.close();
/** * 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."); } iter.remove(); }
/** * Checks whether the source type iteration contains more elements. * * @return <tt>true</tt> if the source type iteration contains more elements, <tt>false</tt> otherwise. * @throws X */ @Override public boolean hasNext() throws X { if (isClosed()) { return false; } boolean result = iter.hasNext(); if (!result) { close(); } return result; }
try { if (result != null) { result.close();
/** * Returns the next element from the source type iteration. * * @throws X * @throws java.util.NoSuchElementException * If all elements have been returned. * @throws IllegalStateException * If the iteration has been closed. */ @Override public T next() throws X { if (isClosed()) { throw new NoSuchElementException("The iteration has been closed."); } return convert(iter.next()); }
/** * 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."); } iter.remove(); }
/** * Checks whether the source type iteration contains more elements. * * @return <tt>true</tt> if the source type iteration contains more elements, <tt>false</tt> otherwise. * @throws X */ @Override public boolean hasNext() throws X { if (isClosed()) { return false; } boolean result = iter.hasNext(); if (!result) { close(); } return result; }
/** * Returns the next element from the source type iteration. * * @throws X * @throws java.util.NoSuchElementException * If all elements have been returned. * @throws IllegalStateException * If the iteration has been closed. */ @Override public T next() throws X { if (isClosed()) { throw new NoSuchElementException("The iteration has been closed."); } return convert(iter.next()); }