public static <GItem> Iterator<GItem> limitedIterator(final int count, final Iterator<? extends GItem> iterator)
		throws NullPointerException, IllegalArgumentException {
		if (count < 0) throw new IllegalArgumentException("count < 0");
		if (iterator == null) throw new NullPointerException("iterator = null");
		if (count == 0) return Iterators.emptyIterator();
		return new BaseIterator<GItem>() {

			int index = 0;

			@Override
			public boolean hasNext() {
				return (this.index < count) && iterator.hasNext();
			}

			@Override
			public GItem next() {
				if (this.index == count) throw new NoSuchElementException();
				this.index++;
				return iterator.next();
			}

			@Override
			public void remove() {
				iterator.remove();
			}

			/** {@inheritDoc} */
			@Override
			public String toString() {
				return Objects.toInvokeString("limitedIterator", count, iterator);
			}

		};
	}