iryndin / jdbf

Java utility to read/write DBF files
108 stars 77 forks source link

Provide an iterator for reading records #14

Open hrj opened 9 years ago

hrj commented 9 years ago

Instead of:

DbfRecord rec;
while ((rec = reader.read()) != null) {
  System.out.println("Record #" + rec.getRecordNumber() + ": " + rec.toMap());
}

it would be nicer to write:

for (final DbfRecord rec: reader.getRecordIterator()) {
  System.out.println("Record #" + rec.getRecordNumber() + ": " + rec.toMap());
}

Using an iterator avoids keeping a mutable reference to DbfRecord.