@Test public void testIterator() { Iterator<Object[]> rowIterator = xmlRowReader.iterator(); int i = 0; while (rowIterator.hasNext()) { i++; Object[] row = rowIterator.next(); assertEquals("v" + i + "1", row[0]); assertEquals("v" + i + "2", row[1]); } assertEquals(3, i); }
@Override public Iterator<Object[]> iterator() { return new Iterator<Object[]>() { private int i = 0; @Override public boolean hasNext() { return i < nodes.getLength(); } @Override public Object[] next() { return fromNode(nodes.item(i++)); } @Override public void remove() { throw new UnsupportedOperationException(); } }; }
XmlRowReader implements RowReader { @Override public Iterator<Object[]> iterator() { return new Iterator<Object[]>() { private int i = 0; @Override public boolean hasNext() { return i < nodes.getLength(); } @Override public Object[] next() { return fromNode(nodes.item(i++)); } @Override public void remove() { throw new UnsupportedOperationException(); } }; } }
XmlRowReader implements RowReader { @Override public Iterator<Object[]> iterator() { return new Iterator<Object[]>() { private int i = 0; @Override public boolean hasNext() { return i < nodes.getLength(); } @Override public Object[] next() { return fromNode(nodes.item(i++)); } @Override public void remove() { throw new UnsupportedOperationException(); } }; } XmlRowReader(XmlRowAttribute[] header, NodeList nodes); }
XmlRowReader implements RowReader { @Override public Iterator<Object[]> iterator() { return new Iterator<Object[]>() { private int i = 0; @Override public boolean hasNext() { return i < nodes.getLength(); } @Override public Object[] next() { return fromNode(nodes.item(i++)); } @Override public void remove() { throw new UnsupportedOperationException(); } }; } XmlRowReader(XmlRowAttribute[] header, NodeList nodes); @Override RowAttribute[] getHeader(); @Override void close(); @Override Iterator<Object[]> iterator(); }
XmlRowReader implements RowReader { @Override public Iterator<Object[]> iterator() { return new Iterator<Object[]>() { private int i = 0; @Override public boolean hasNext() { return i < nodes.getLength(); } @Override public Object[] next() { return fromNode(nodes.item(i++)); } @Override public void remove() { throw new UnsupportedOperationException(); } }; } XmlRowReader(XmlRowAttribute[] header, NodeList nodes); @Override RowAttribute[] getHeader(); @Override void close(); @Override Iterator<Object[]> iterator();  }