Comparator
As for sorting Collection, it is more efficient to implement either comparator or comparable and put all the compare method in one place. Collections . sort ( criticalAndImportantUpdates , new CriticalAndImportantUpdatesComparator ( themeDisplay , contentStatusLocalService ). acknowledgedComparator ); Collections . sort ( criticalAndImportantUpdates , new CriticalAndImportantUpdatesComparator ( themeDisplay , contentStatusLocalService ). dateComparator ); ---------------------------------------------------------------------------------------------------------------------- public class CriticalAndImportantUpdatesComparator { private ThemeDisplay themeDisplay ; public CriticalAndImportantUpdatesComparator ( ThemeDisplay themeDisplay , ContentStatusLocalService contentStatusLocalService ) { this . themeDisplay = themeDisplay ; ...