### Question:
FirstEntryInRowIterator extends SkippingIterator implements OptionDescriber { public static void setNumScansBeforeSeek(IteratorSetting cfg, int num) { cfg.addOption(NUM_SCANS_STRING_NAME, Integer.toString(num)); } FirstEntryInRowIterator();  FirstEntryInRowIterator(FirstEntryInRowIterator other, IteratorEnvironment env); static void setNumScansBeforeSeek(IteratorSetting cfg, int num); @Override SortedKeyValueIterator<Key,Value> deepCopy(IteratorEnvironment env); @Override void init(SortedKeyValueIterator<Key,Value> source, Map<String,String> options,
      IteratorEnvironment env); @Override boolean hasTop(); @Override void seek(Range range, Collection<ByteSequence> columnFamilies, boolean inclusive); @Override IteratorOptions describeOptions(); @Override boolean validateOptions(Map<String,String> options);  }### Answer:
@Test public void test() throws IOException { TreeMap<Key,Value> sourceMap = new TreeMap<>(); Value emptyValue = new Value(""); IteratorSetting iteratorSetting = new IteratorSetting(1, FirstEntryInRowIterator.class); FirstEntryInRowIterator.setNumScansBeforeSeek(iteratorSetting, 10); assertTrue( iteratorSetting.getOptions().containsKey(FirstEntryInRowIterator.NUM_SCANS_STRING_NAME)); sourceMap.put(new Key("r1", "cf", "cq"), emptyValue); sourceMap.put(new Key("r2", "cf", "cq"), emptyValue); sourceMap.put(new Key("r3", "cf", "cq"), emptyValue); TreeMap<Key,Value> resultMap = new TreeMap<>(); long numSourceEntries = sourceMap.size(); long numNexts = process(sourceMap, resultMap, new Range(), iteratorSetting); assertEquals(numNexts, numSourceEntries); assertEquals(sourceMap.size(), resultMap.size()); for (int i = 0; i < 20; i++) { sourceMap.put(new Key("r2", "cf", "cq" + i), emptyValue); } resultMap.clear(); numNexts = process(sourceMap, resultMap, new Range(new Key("r1"), (new Key("r2")).followingKey(PartialKey.ROW)), iteratorSetting); assertEquals(numNexts, resultMap.size() + 10); assertEquals(resultMap.size(), 2); resultMap.clear(); numNexts = process(sourceMap, resultMap, new Range(new Key("r1"), new Key("r2", "cf2")), iteratorSetting); assertEquals(numNexts, resultMap.size() + 10); assertEquals(resultMap.size(), 2); resultMap.clear(); numNexts = process(sourceMap, resultMap, new Range(new Key("r1"), new Key("r4")), iteratorSetting); assertEquals(numNexts, resultMap.size() + 10); assertEquals(resultMap.size(), 3); }