java - Faster method of Grouping Times -
i receive json object filled data , 1 of tasks data group times together. for example, if game_time 12:15 pm should under 12 pm header. i came solution monstrosity , difficult debug, there has better way this. dbdate = dateformatter.parse(json_data.getstring("game_time")); if (dbdate.compareto(dateformatter.parse("12:00 am")) == 0 || dbdate.compareto(dateformatter.parse("1:00 am") ) < 0) { users12am.add(json_data.getstring("in_game_name")); } else if (dbdate.compareto(dateformatter.parse("1:00 am")) == 0 || dbdate.compareto(dateformatter.parse("2:00 am")) < 0) { users1am.add(json_data.getstring("in_game_name")); } else if (dbdate.compareto(dateformatter.parse("2:00 am")) == 0 || dbdate.compareto(dateformatter.parse("3:00 am")) < 0) { users2am.add(json_data.getstring("in_game_name")); } else if (dbdate.compareto(dateformatter.parse("3:00 am&quo