docs: @Override
  	public Iterator<T> sample(final Iterator<T> input) {
  		if (fraction == 0) {
  			return emptyIterable;
  		}
  
  		return new SampledIterator<T>() {
  			T currentElement;
  			int currentCount = 0;
  
  			@Override
  			public boolean hasNext() {
  				if (currentCount > 0) {
  					return true;
  				} else {
  					samplingProcess();
  					if (currentCount > 0) {
  						return true;
  					} else {
  						return false;
  					}
  				}
  			}
  
  			@Override
  			public T next() {
  				if (currentCount <= 0) {
  					samplingProcess();
  				}
  				currentCount--;
  				return currentElement;
  			}
  
  			public int poisson_ge1(double p) {
  				// sample 'k' from Poisson(p), conditioned to k >= 1.
  				double q = Math.pow(Math.E, -p);
  				// simulate a poisson trial such that k >= 1.
  				double t = q + (1 - q) * random.nextDouble();
  				int k = 1;
  				// continue standard poisson generation trials.
  				t = t * random.nextDouble();
  				while (t > q) {
  					k++;
  					t = t * random.nextDouble();
  				}
  				return k;
  			}
  
  			private void skipGapElements(int num) {
  				// skip the elements that occurrence number is zero.
  				int elementCount = 0;
  				while (input.hasNext() && elementCount < num) {
  					currentElement = input.next();
  					elementCount++;
  				}
  			}
  
  			private void samplingProcess() {
  				if (fraction <= THRESHOLD) {
  					double u = Math.max(random.nextDouble(), EPSILON);
  					int gap = (int) (Math.log(u) / -fraction);
  					skipGapElements(gap);
  					if (input.hasNext()) {
  						currentElement = input.next();
  						currentCount = poisson_ge1(fraction);
  					}
  				} else {
  					while (input.hasNext()) {
  						currentElement = input.next();
  						currentCount = poissonDistribution.sample();
  						if (currentCount > 0) {
  							break;
  						}
  					}
  				}
  			}
  		};
  	}