/** * Returns {@code true} if the iteration has more elements. (In other * words, returns {@code true} if {@code next} would return an element * rather than throwing an exception.) * * @return {@code true} if the iterator has more elements. */ public boolean hasNext() { return (next != null || fetchNext() != null); }
private String fetchReverse() { // Get previous position int prevPos = scanForPrev(); // Store next string next = string.substring(prevPos + 1, maxPosition - position); if (includeDelimiters && prevPos >= 0 && prevPos < maxPosition) { nextDelimiter = string.substring(prevPos, prevPos + 1); } position = maxPosition - prevPos; // Skip empty if (next.length() == 0 && !includeEmpty) { return fetchNext(); } return next; }
/** * Returns the next element in the iteration. * * @return the next element in the iteration. * @exception java.util.NoSuchElementException iteration has no more elements. */ public String next() { if (!hasNext()) { throw new NoSuchElementException(); } String next = this.next; this.next = fetchNext(); return next; }
private String fetchForward() { // Get next position int nextPos = scanForNext(); // Store next string next = string.substring(position, nextPos); if (includeDelimiters && nextPos >= 0 && nextPos < maxPosition) { nextDelimiter = string.substring(nextPos, nextPos + 1); } position = ++nextPos; // Skip empty if (next.length() == 0 && !includeEmpty) { return fetchNext(); } return next; }
/** * Returns {@code true} if the iteration has more elements. (In other * words, returns {@code true} if {@code next} would return an element * rather than throwing an exception.) * * @return {@code true} if the iterator has more elements. */ public boolean hasNext() { return (next != null || fetchNext() != null); }
/** * Returns {@code true} if the iteration has more elements. (In other * words, returns {@code true} if {@code next} would return an element * rather than throwing an exception.) * * @return {@code true} if the iterator has more elements. */ public boolean hasNext() { return (mNext != null || fetchNext() != null); }
/** * Returns {@code true} if the iteration has more elements. (In other * words, returns {@code true} if {@code next} would return an element * rather than throwing an exception.) * * @return {@code true} if the iterator has more elements. */ public boolean hasNext() { return (next != null || fetchNext() != null); }
/** * Returns the next element in the iteration. * * @return the next element in the iteration. * @exception java.util.NoSuchElementException iteration has no more elements. */ public String next() { if (!hasNext()) { throw new NoSuchElementException(); } String next = this.next; this.next = fetchNext(); return next; }
/** * Returns the next element in the iteration. * * @return the next element in the iteration. * @exception java.util.NoSuchElementException iteration has no more elements. */ public String next() { if (!hasNext()) { throw new NoSuchElementException(); } String next = this.next; this.next = fetchNext(); return next; }
/** * Returns the next element in the iteration. * * @return the next element in the iteration. * @exception java.util.NoSuchElementException iteration has no more elements. */ public String next() { if (!hasNext()) { throw new NoSuchElementException(); } String next = mNext; mNext = fetchNext(); return next; }
private String fetchReverse() { // Get previous position int prevPos = scanForPrev(); // Store next string next = string.substring(prevPos + 1, maxPosition - position); if (includeDelimiters && prevPos >= 0 && prevPos < maxPosition) { nextDelimiter = string.substring(prevPos, prevPos + 1); } position = maxPosition - prevPos; // Skip empty if (next.length() == 0 && !includeEmpty) { return fetchNext(); } return next; }
private String fetchReverse() { // Get previous position int prevPos = scanForPrev(); // Store next string mNext = mString.substring(prevPos + 1, mMaxPosition - mPosition); if (mIncludeDelimiters && prevPos >= 0 && prevPos < mMaxPosition) { mNextDelimiter = mString.substring(prevPos, prevPos + 1); } mPosition = mMaxPosition - prevPos; // Skip empty if (mNext.length() == 0 && !mIncludeEmpty) { return fetchNext(); } return mNext; }
private String fetchForward() { // Get next position int nextPos = scanForNext(); // Store next string next = string.substring(position, nextPos); if (includeDelimiters && nextPos >= 0 && nextPos < maxPosition) { nextDelimiter = string.substring(nextPos, nextPos + 1); } position = ++nextPos; // Skip empty if (next.length() == 0 && !includeEmpty) { return fetchNext(); } return next; }
private String fetchReverse() { // Get previous position int prevPos = scanForPrev(); // Store next string next = string.substring(prevPos + 1, maxPosition - position); if (includeDelimiters && prevPos >= 0 && prevPos < maxPosition) { nextDelimiter = string.substring(prevPos, prevPos + 1); } position = maxPosition - prevPos; // Skip empty if (next.length() == 0 && !includeEmpty) { return fetchNext(); } return next; }
private String fetchForward() { // Get next position int nextPos = scanForNext(); // Store next string next = string.substring(position, nextPos); if (includeDelimiters && nextPos >= 0 && nextPos < maxPosition) { nextDelimiter = string.substring(nextPos, nextPos + 1); } position = ++nextPos; // Skip empty if (next.length() == 0 && !includeEmpty) { return fetchNext(); } return next; }
private String fetchForward() { // Get next position int nextPos = scanForNext(); // Store next string mNext = mString.substring(mPosition, nextPos); if (mIncludeDelimiters && nextPos >= 0 && nextPos < mMaxPosition) { mNextDelimiter = mString.substring(nextPos, nextPos + 1); } mPosition = ++nextPos; // Skip empty if (mNext.length() == 0 && !mIncludeEmpty) { return fetchNext(); } return mNext; }