SamplingLongPrimitiveIterator extends AbstractLongPrimitiveIterator { @Override public boolean hasNext() { return hasNext; } SamplingLongPrimitiveIterator(LongPrimitiveIterator delegate, double samplingRate);  SamplingLongPrimitiveIterator(RandomWrapper random, LongPrimitiveIterator delegate, double samplingRate); @Override boolean hasNext(); @Override long nextLong(); @Override long peek(); @Override void remove(); @Override void skip(int n); static LongPrimitiveIterator maybeWrapIterator(LongPrimitiveIterator delegate, double samplingRate);  }
@Test public void testEmptyCase() { assertFalse(new SamplingLongPrimitiveIterator( countingIterator(0), 0.9999).hasNext()); assertFalse(new SamplingLongPrimitiveIterator( countingIterator(0), 1).hasNext()); }
@Test public void testExactSizeMatch() { SamplingLongPrimitiveIterator t = new SamplingLongPrimitiveIterator( countingIterator(10), 1); for (int i = 0; i < 10; i++) { assertTrue(t.hasNext()); assertEquals(i, t.next().intValue()); } assertFalse(t.hasNext()); }