@Override
	public T peek() throws NoSuchElementException {
		if (peeked) {
			return peek;
		}

		if (!hasNext()) {
			throw new NoSuchElementException();
		}

		peek = next();
		peeked = true;
		return peek;
	}
An implementation of {@link PeekableIterator} that can take a Java {@link Iterator} and 
wrap it to implement the {@link PeekableIterator} interface.

@param <T> the type of the iterator
Ghidra/Framework/Generic/src/main/java/generic/util/WrappingPeekableIterator.java