public int next() {
            if (hasNext()) {
                int val = current.val;
                current = null;
                return val;
            } else {
                // Follow the contract of java.util.Iterator
                throw new java.util.NoSuchElementException();
            }
        }