code: public static <T> String generateCommaSeparatedList(Collection<T> list) {
          if (list == null || list.size() == 0) {
              return "";
          }
          StringBuilder result = new StringBuilder();
          for (Object obj : list) {
              result.append(',').append(obj.toString());
          }
          return result.length() == 0 ? "" : result.substring(1);
      }
docs: Returns a comma seperated list of items as a string
  @param list the collecion
  @param <T> the type
  @return comma separated string