code: private JSONValue datesToJsonArray(Collection<Date> dates) {
  
          if (null != dates) {
              JSONArray result = new JSONArray();
              for (Date d : dates) {
                  result.set(result.size(), dateToJson(d));
              }
              return result;
          }
          return null;
      }
docs: Converts a collection of dates to a JSON array with the long representation of the dates as strings.
  @param dates the list to convert.
  @return JSON array with long values of dates as string