public void generatePotentialMenuTimes ( ArrayList < LocalTime > desiredTimes ) { potentialMenuTimes = new ArrayList < LocalTime > ( ) ; if ( desiredTimes == null || desiredTimes . isEmpty ( ) ) { return ; } TreeSet < LocalTime > timeSet = new TreeSet < LocalTime > ( ) ; for ( LocalTime desiredTime : desiredTimes ) { if ( desiredTime != null ) { timeSet . add ( desiredTime ) ; } } for ( LocalTime timeSetEntry : timeSet ) { potentialMenuTimes . add ( timeSetEntry ) ; } }
generatePotentialMenuTimes This will generate the menu times for populating the combo box menu using the items from a list of LocalTime instances . The list will be sorted and cleaned of duplicates before use . Null values and duplicate values will not be added . When this function is complete the menu will contain one instance of each unique LocalTime that was supplied to this function in ascending order going from Midnight to 11 . 59pm . The drop down menu will not contain any time values except those supplied in the desiredTimes list .