code: @SuppressWarnings("unchecked")
    private static List<?> groupAsList(Object group) {
      if (group.getClass().isArray()) {
        return wrap(group);
      } else if (group instanceof Collection<?>) {
        List<Object> asList = new ArrayList<Object>();
        asList.addAll(((Collection<Object>) group));
        return asList;
      }
      throw new IllegalArgumentException("Parameter should be an array or a collection but was " + group);
    }
docs: Convert the given group (which is either an array or a Collection) to a List.
  @param group the group to convert
  @return the corresponding List
  @throws IllegalArgumentException if group can't be converted to a List