package lectures.exceptions;
import util.annotations.WebDocuments;

import java.util.NoSuchElementException;

import lectures.iterator.CharIterator;

@WebDocuments({"Lectures/Exceptions.pptx", "Lectures/Exceptions.pdf", "Videos/Exceptions.avi"})
public class AllUpperCaseLettersInOrderThrowingException implements
        CharIterator {
    char nextLetter = 'A';

    public boolean hasNext() {
        return nextLetter <= 'Z';
    }

    public char next() throws NoSuchElementException {
        if (!hasNext())
            throw new NoSuchElementException();
        char retVal = nextLetter;
        nextLetter = (char) (nextLetter + 1);
        return retVal;
    }
}