// FIXME take care of NPE here !!!
List<ConsumerScanningStatistics> ret =
new ArrayList<ConsumerScanningStatistics>( instance.getConsumerCounts().size() );
for ( Map.Entry<String, Long> entry : instance.getConsumerCounts().entrySet() )
{
ConsumerScanningStatistics consumerScanningStatistics = new ConsumerScanningStatistics();
consumerScanningStatistics.setConsumerKey( entry.getKey() );
consumerScanningStatistics.setCount( entry.getValue() );
consumerScanningStatistics.setTime( instance.getConsumerTimings().get( entry.getKey() ) );
if ( consumerScanningStatistics.getCount() > 0 )
{
consumerScanningStatistics.setAverage( decimalFormat.format(
consumerScanningStatistics.getTime() / consumerScanningStatistics.getCount() ) );
}
ret.add( consumerScanningStatistics );
}
Collections.sort( ret, ConsumerScanningStatisticsComparator.INSTANCE );
return ret;