java/dictionary-generator/src/cz/frantovo/telco/dictionary/OneItemIterator.java
author František Kučera <franta-hg@frantovo.cz>
Fri, 16 Aug 2013 22:43:59 +0200
changeset 88 6d41445d3f6e
parent 15 93208f791318
child 151 a9f1ba451247
permissions -rw-r--r--
data: UCS-2 message length
franta-hg@15
     1
/**
franta-hg@15
     2
 * Free Telco Dictionary
franta-hg@15
     3
 * Copyright © 2013 František Kučera (frantovo.cz)
franta-hg@15
     4
 *
franta-hg@15
     5
 * This program is free software: you can redistribute it and/or modify
franta-hg@15
     6
 * it under the terms of the GNU General Public License as published by
franta-hg@15
     7
 * the Free Software Foundation, either version 3 of the License, or
franta-hg@15
     8
 * (at your option) any later version.
franta-hg@15
     9
 *
franta-hg@15
    10
 * This program is distributed in the hope that it will be useful,
franta-hg@15
    11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
franta-hg@15
    12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
franta-hg@15
    13
 * GNU General Public License for more details.
franta-hg@15
    14
 *
franta-hg@15
    15
 * You should have received a copy of the GNU General Public License
franta-hg@15
    16
 * along with this program. If not, see <http://www.gnu.org/licenses/>.
franta-hg@15
    17
 */
franta-hg@15
    18
package cz.frantovo.telco.dictionary;
franta-hg@15
    19
franta-hg@15
    20
import java.util.Iterator;
franta-hg@15
    21
franta-hg@15
    22
/**
franta-hg@15
    23
 *
franta-hg@15
    24
 * @author Ing. František Kučera (frantovo.cz)
franta-hg@15
    25
 */
franta-hg@15
    26
public class OneItemIterator<T> implements Iterator<T> {
franta-hg@15
    27
franta-hg@15
    28
	private final T item;
franta-hg@15
    29
	private boolean unused = true;
franta-hg@15
    30
franta-hg@15
    31
	public OneItemIterator(T item) {
franta-hg@15
    32
		this.item = item;
franta-hg@15
    33
	}
franta-hg@15
    34
franta-hg@15
    35
	@Override
franta-hg@15
    36
	public boolean hasNext() {
franta-hg@15
    37
		return unused;
franta-hg@15
    38
	}
franta-hg@15
    39
franta-hg@15
    40
	@Override
franta-hg@15
    41
	public T next() {
franta-hg@15
    42
		return item;
franta-hg@15
    43
	}
franta-hg@15
    44
franta-hg@15
    45
	@Override
franta-hg@15
    46
	public void remove() {
franta-hg@15
    47
		throw new UnsupportedOperationException("remove not supported");
franta-hg@15
    48
	}
franta-hg@15
    49
}