private void cleanupMapIfNeeded(){
  final int numberOfMsgKept=m_msgRepToMsgStatsMap.size();
  if (numberOfMsgKept > m_numberOfParseErrorToRunCleanup) {
    writeToLog();
    final List<MessageStats> statsArray=new ArrayList<MessageStats>(m_msgRepToMsgStatsMap.values());
    Collections.sort(statsArray);
    for (    MessageStats stats : statsArray) {
      final String msgRep=stats.getMessageRepresentation();
      m_msgRepToMsgStatsMap.remove(msgRep);
      if (m_msgRepToMsgStatsMap.size() <= m_numberOfParseErrorToKeepMax) {
        break;
      }
    }
  }
}

private void cleanupMapIfNeeded ( ) { final int numberOfMsgKept = m_msgRepToMsgStatsMap . size ( ) ; if ( numberOfMsgKept > m_numberOfParseErrorToRunCleanup ) { writeToLog ( ) ; final List < MessageStats > statsArray = new ArrayList < MessageStats > ( m_msgRepToMsgStatsMap . values ( ) ) ; Collections . sort ( statsArray ) ; for ( MessageStats stats : statsArray ) { final String msgRep = stats . getMessageRepresentation ( ) ; m_msgRepToMsgStatsMap . remove ( msgRep ) ; if ( m_msgRepToMsgStatsMap . size ( ) <= m_numberOfParseErrorToKeepMax ) { break ; } } } }
clean up the map
