static void redistributeBuckets(ArrayList<NotificationInfo> highPriorityEvents,ArrayList<NotificationInfo> mediumPriorityEvents,ArrayList<NotificationInfo> lowPriorityEvents,int maxNotifications){
  if (highPriorityEvents.size() > maxNotifications) {
    lowPriorityEvents.addAll(0,mediumPriorityEvents);
    List<NotificationInfo> itemsToMoveSublist=highPriorityEvents.subList(0,highPriorityEvents.size() - maxNotifications);
    lowPriorityEvents.addAll(0,itemsToMoveSublist);
    if (DEBUG) {
      logEventIdsBumped(mediumPriorityEvents,itemsToMoveSublist);
    }
    mediumPriorityEvents.clear();
    itemsToMoveSublist.clear();
  }
  if (mediumPriorityEvents.size() + highPriorityEvents.size() > maxNotifications) {
    int spaceRemaining=maxNotifications - highPriorityEvents.size();
    List<NotificationInfo> itemsToMoveSublist=mediumPriorityEvents.subList(spaceRemaining,mediumPriorityEvents.size());
    lowPriorityEvents.addAll(0,itemsToMoveSublist);
    if (DEBUG) {
      logEventIdsBumped(itemsToMoveSublist,null);
    }
    itemsToMoveSublist.clear();
  }
}

static void redistributeBuckets ( ArrayList < NotificationInfo > highPriorityEvents , ArrayList < NotificationInfo > mediumPriorityEvents , ArrayList < NotificationInfo > lowPriorityEvents , int maxNotifications ) { if ( highPriorityEvents . size ( ) > maxNotifications ) { lowPriorityEvents . addAll ( 0 , mediumPriorityEvents ) ; List < NotificationInfo > itemsToMoveSublist = highPriorityEvents . subList ( 0 , highPriorityEvents . size ( ) - maxNotifications ) ; lowPriorityEvents . addAll ( 0 , itemsToMoveSublist ) ; if ( DEBUG ) { logEventIdsBumped ( mediumPriorityEvents , itemsToMoveSublist ) ; } mediumPriorityEvents . clear ( ) ; itemsToMoveSublist . clear ( ) ; } if ( mediumPriorityEvents . size ( ) + highPriorityEvents . size ( ) > maxNotifications ) { int spaceRemaining = maxNotifications - highPriorityEvents . size ( ) ; List < NotificationInfo > itemsToMoveSublist = mediumPriorityEvents . subList ( spaceRemaining , mediumPriorityEvents . size ( ) ) ; lowPriorityEvents . addAll ( 0 , itemsToMoveSublist ) ; if ( DEBUG ) { logEventIdsBumped ( itemsToMoveSublist , null ) ; } itemsToMoveSublist . clear ( ) ; } }
redistributes events in the priority lists based on the max # of notifications we can show .
