Buggy code:
public class BostonSerial { private static UtilityMethods utilityMethods = new UtilityMethods ( ) ; public String [ ] [ ] bostonSerial ( HashMap < String , ArrayList < String > > student_preferences , ArrayList < String > project_list ) { String [ ] [ ] matrix = BostonSerial . utilityMethods . setUpMatrix ( student_preferences . keySet ( ) , project_list ) ; HashMap < String , Fraction > project_allocation = new HashMap < > ( ) ; HashMap < String , Fraction > student_allocation = new HashMap < > ( ) ; int i = 0 ; while ( i < ( project_list . size ( ) ) ) { project_allocation . put ( project_list . get ( i ) , new Fraction ( 0 ) ) ; i ++ ; } System . out . println ( project_allocation . toString ( ) ) ; for ( String name : student_preferences . keySet ( ) ) { student_allocation . put ( name , new Fraction ( 0 ) ) ; } System . out . println ( student_allocation . toString ( ) ) ; System . out . println ( student_preferences . toString ( ) ) ; HashMap < String , Fraction > current_projects = new HashMap < > ( ) ; int k = 0 ; while ( k < ( project_list . size ( ) ) ) { current_projects . put ( ( ( String ) ( project_list . get ( k ) ) ) , new Fraction ( 0 ) ) ; k ++ ; } HashMap < String , Fraction > max_project_increments = new HashMap < > ( ) ; HashMap < String , Fraction > max_student_increments = new HashMap < > ( ) ; <START_BUG> while ( student_preferences . isEmpty ( ) ) { <END_BUG> max_project_increments . clear ( ) ; max_student_increments . clear ( ) ; HashMap < String , Fraction > currentProjects = BostonSerial . utilityMethods . getCurrentProjects ( student_preferences , current_projects ) ; System . out . println ( ( "Current<seq2seq4repair_space>Projects:<seq2seq4repair_space>" + ( currentProjects . toString ( ) ) ) ) ; for ( String project : current_projects . keySet ( ) ) { if ( ( current_projects . get ( project ) . compareTo ( new Fraction ( 0 ) ) ) == 0 ) continue ; Fraction max_increment_for_project = new Fraction ( 1 ) . subtract ( project_allocation . get ( project ) ) ; if ( ( current_projects . get ( project ) . compareTo ( new Fraction ( 1 ) ) ) > 0 ) { Fraction new_increment = max_increment_for_project . divide ( current_projects . get ( project ) ) ; max_project_increments . put ( project , new_increment ) ; } else { max_project_increments . put ( project , max_increment_for_project ) ; } } for ( String student : student_preferences . keySet ( ) ) { Fraction max_increment_for_student = new Fraction ( 1 ) . subtract ( student_allocation . get ( student ) ) ; max_student_increments . put ( student , max_increment_for_student ) ; } System . out . println ( ( "Max<seq2seq4repair_space>increments<seq2seq4repair_space>for<seq2seq4repair_space>projects:<seq2seq4repair_space>" + max_project_increments ) ) ; System . out . println ( ( "Max<seq2seq4repair_space>increments<seq2seq4repair_space>for<seq2seq4repair_space>students:<seq2seq4repair_space>" + max_student_increments ) ) ; for ( String name : student_preferences . keySet ( ) ) { ArrayList < String > preferences = student_preferences . get ( name ) ; if ( preferences . isEmpty ( ) ) continue ; String current_project = preferences . get ( 0 ) ; if ( ( project_allocation . get ( current_project ) . compareTo ( new Fraction ( 1 ) ) ) == 0 ) continue ; Fraction incrementValue ; Fraction max_student_increment = max_student_increments . get ( name ) ; Fraction max_project_increment = max_project_increments . get ( current_project ) ; if ( ( max_student_increment . compareTo ( max_project_increment ) ) < 0 ) { incrementValue = max_student_increment ; } else { incrementValue = max_project_increment ; } System . out . println ( ( ( ( "Student:<seq2seq4repair_space>" + name ) + "<seq2seq4repair_space>Project:<seq2seq4repair_space>" ) + current_project ) ) ; System . out . println ( ( ( "Increment:<seq2seq4repair_space>" + incrementValue ) + "\n" ) ) ; student_allocation . put ( name , student_allocation . get ( name ) . add ( incrementValue ) ) ; project_allocation . put ( current_project , project_allocation . get ( current_project ) . add ( incrementValue ) ) ; BostonSerial . utilityMethods . incrementValue ( matrix , name , current_project , incrementValue ) ; } System . out . println ( ( "Student<seq2seq4repair_space>Allocation:<seq2seq4repair_space>" + ( student_allocation . toString ( ) ) ) ) ; System . out . println ( ( "Project<seq2seq4repair_space>Allocation:<seq2seq4repair_space>" + ( project_allocation . toString ( ) ) ) ) ; System . out . println ( ( "Student<seq2seq4repair_space>preferences<seq2seq4repair_space>before<seq2seq4repair_space>removal:<seq2seq4repair_space>" + ( student_preferences . toString ( ) ) ) ) ; BostonSerial . utilityMethods . removeMatched ( student_preferences , project_allocation , student_allocation ) ; System . out . println ( ( "Student<seq2seq4repair_space>preferences:<seq2seq4repair_space>" + ( student_preferences . toString ( ) ) ) ) ; } for ( String [ ] row : matrix ) { System . out . println ( Arrays . toString ( row ) ) ; } return matrix ; } }

Fix:
while ( ! ( student_preferences . isEmpty ( ) ) ) {