@Override public final boolean hasNext() { if (isClosed()) { return false; } lookAhead(); return nextElement != null; }
@Override public final boolean hasNext() { if (isClosed()) { return false; } lookAhead(); return nextElement != null; }
@Override public final boolean hasNext() { if (isClosed()) { return false; } lookAhead(); return nextElement != null; }
@Override public final E next() { if (isClosed()) { throw new NoSuchElementException("The iteration has been closed."); } lookAhead(); E result = nextElement; if (result != null) { nextElement = null; return result; } else { throw new NoSuchElementException(); } }
@Override public final E next() { if (isClosed()) { throw new NoSuchElementException("The iteration has been closed."); } lookAhead(); E result = nextElement; if (result != null) { nextElement = null; return result; } else { throw new NoSuchElementException(); } }
@Override public final E next() { if (isClosed()) { throw new NoSuchElementException("The iteration has been closed."); } lookAhead(); E result = nextElement; if (result != null) { nextElement = null; return result; } else { throw new NoSuchElementException(); } }
/** * Fetches the next element if it hasn't been fetched yet and stores it in {@link #nextElement}. * * @throws X */ private void lookAhead() { if (nextElement == null && !isClosed()) { nextElement = getNextElement(); if (nextElement == null) { try { close(); } catch (IOException ioe) { closeException = ioe; } } } }
/** * Fetches the next element if it hasn't been fetched yet and stores it in {@link #nextElement}. * * @throws X */ private void lookAhead() { if (nextElement == null && !isClosed()) { nextElement = getNextElement(); if (nextElement == null) { try { close(); } catch (IOException ioe) { closeException = ioe; } } } }
/** * Fetches the next element if it hasn't been fetched yet and stores it in {@link #nextElement}. * * @throws X */ private void lookAhead() { if (nextElement == null && !isClosed()) { nextElement = getNextElement(); if (nextElement == null) { try { close(); } catch (IOException ioe) { closeException = ioe; } } } }