### Question:
RowIterator implements Iterator<Iterator<Entry<Key,Value>>> { public RowIterator(Iterator<Entry<Key,Value>> iterator) { this.iter = new PeekingIterator<>(iterator); } RowIterator(Iterator<Entry<Key,Value>> iterator);  RowIterator(Iterable<Entry<Key,Value>> iterable); @Override boolean hasNext(); @Override Iterator<Entry<Key,Value>> next(); @Override void remove(); long getKVCount();  }### Answer:
@Test public void testRowIterator() { List<List<Entry<Key,Value>>> rows = getRows(makeIterator()); assertEquals(0, rows.size()); rows = getRows(makeIterator("a b c d")); assertEquals(1, rows.size()); assertEquals(1, rows.get(0).size()); rows = getRows(makeIterator("a cf cq1 v", "a cf cq2 v", "a cf cq3 v", "b cf cq1 x")); assertEquals(2, rows.size()); assertEquals(3, rows.get(0).size()); assertEquals(1, rows.get(1).size()); RowIterator i = new RowIterator(makeIterator()); try { i.next(); fail(); } catch (NoSuchElementException ex) {} i = new RowIterator(makeIterator("a b c d", "a 1 2 3")); assertTrue(i.hasNext()); Iterator<Entry<Key,Value>> row = i.next(); assertTrue(row.hasNext()); row.next(); assertTrue(row.hasNext()); row.next(); assertFalse(row.hasNext()); try { row.next(); fail(); } catch (NoSuchElementException ex) {} assertEquals(0, i.getKVCount()); assertFalse(i.hasNext()); assertEquals(2, i.getKVCount()); try { i.next(); fail(); } catch (NoSuchElementException ex) {} }