public Date getNextPickupDateByWasteTypeLabel(String wasteTypeLabel) { Pickup pickup = getPickupByWasteTypeLabel(wasteTypeLabel); if (pickup == null) return null; List<String> dates = pickup.getDates(); if (dates.isEmpty()) return null; for (int i = 0; i <= 32; i++) { Date date = Date.inDays(i); String dateAsString = date.toString(); if (dates.contains(dateAsString)) return date; } return null; }
public void addDate(Date date) { Set<String> dates = new HashSet<String>(getDates()); dates.add(date.toString()); json.put("dates", Utl.sort(dates)); }