public void setEntitiesMapping(Map entityToReplacementText) {
// Sets the maximum length for replacement text.
Collection values = entityToReplacementText.values();
if (values instanceof FastCollection) { // Avoids allocating iterators.
FastCollection fc = (FastCollection) values;
for (Record r=fc.head(), t=fc.tail(); (r = r.getNext())!= t;) {
CharSequence value = (CharSequence) fc.valueOf(r);
if (_maxLength < value.length()) {
_maxLength = value.length();
}
}