001/*
002 * Licensed to the Apache Software Foundation (ASF) under one or more
003 * contributor license agreements.  See the NOTICE file distributed with
004 * this work for additional information regarding copyright ownership.
005 * The ASF licenses this file to You under the Apache License, Version 2.0
006 * (the "License"); you may not use this file except in compliance with
007 * the License.  You may obtain a copy of the License at
008 *
009 *     http://www.apache.org/licenses/LICENSE-2.0
010 *
011 * Unless required by applicable law or agreed to in writing, software
012 * distributed under the License is distributed on an "AS IS" BASIS,
013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014 * See the License for the specific language governing permissions and
015 * limitations under the License.
016 */
017package org.apache.commons.collections.primitives;
018
019/**
020 * An iterator over <code>char</code> values.
021 *
022 * @see org.apache.commons.collections.primitives.adapters.CharIteratorIterator
023 * @see org.apache.commons.collections.primitives.adapters.IteratorCharIterator
024 *
025 * @since Commons Primitives 1.0
026 * @version $Revision: 480460 $ $Date: 2006-11-29 03:14:21 -0500 (Wed, 29 Nov 2006) $
027 * 
028 * @author Rodney Waldhoff 
029 */
030public interface CharIterator {
031    /** 
032     * Returns <code>true</code> iff I have more elements. 
033     * (In other words, returns <code>true</code> iff 
034     * a subsequent call to {@link #next next} will return 
035     * an element rather than throwing an exception.)
036     * 
037     * @return <code>true</code> iff I have more elements
038     */
039    boolean hasNext();
040    
041    /** 
042     * Returns the next element in me.
043     * 
044     * @return the next element in me
045     * @throws java.util.NoSuchElementException if there is no next element
046     */          
047    char next();
048    
049    /** 
050     * Removes from my underlying collection the last 
051     * element {@link #next returned} by me 
052     * (optional operation). 
053     * 
054     * @throws UnsupportedOperationException if this operation is not supported
055     * @throws IllegalStateException if {@link #next} has not yet been 
056     *         called, or {@link #remove} has already been called since 
057     *         the last call to {@link #next}.
058     */          
059    void remove();
060}