Skip to content

Instantly share code, notes, and snippets.

Created April 12, 2017 07:59
What would you like to do?
private TreeMap<Date, List<Dinner>> getPreparedHashMap(Dinner[] dinners) {
TreeMap<Date, List<Dinner>> preparedRows = new TreeMap<>();
Calendar calendarInstance = Calendar.getInstance();
calendarInstance.setTime(TimeUtils.getSaturdayDate(new Date()));
for (int i = 0; i < TimeUtils.DAYS_IN_PLANNER; i++) {
Date date = calendarInstance.getTime();
List<Dinner> dinnersList = new ArrayList<>();
for (Dinner dinner : dinners) {
if (dinner.getDate().getTime() == date.getTime()) {
preparedRows.put(date, dinnersList);
calendarInstance.roll(Calendar.DATE, true);
return preparedRows;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment