{
final String[] terms = tfs.keys(new String[0]);
Arrays.sort(terms);
for (String t : terms)
{
final FieldLexiconEntry fle = new FieldLexiconEntry(getFieldFrequency(t));
fle.setTermId(TermCodes.getCode(t));
fle.setStatistics(nts.get(t), tfs.get(t));
final int[] TFf = new int[fieldCount];
for(int fi=0;fi< fieldCount;fi++)
TFf[fi] = field_tfs[fi].get(t);
fle.setFieldFrequencies(TFf);
lexiconStream.writeNextEntry(t, fle);
}
}