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