code: public static Class<?>[] resolveCollectionType(Type type) {
      Class<?>[] output = new Class[2];
      if (type instanceof Class) {
        output[0] = (Class<?>) type;
      } else if (type instanceof ParameterizedType) {
        ParameterizedType parameterizedType = (ParameterizedType) type;
        Type[] argTypes = parameterizedType.getActualTypeArguments();
        output[0] = (Class<?>) parameterizedType.getRawType();
        if (argTypes != null && argTypes.length == 1 && argTypes[0] instanceof Class) {
          output[1] = (Class<?>) argTypes[0];
        }
      } else {
        throw new IllegalArgumentException(
            String.format("Type %s is neither a Class nor a ParameterizedType", type));
      }
      return output;
    }
docs: Examines the given Collection type (List and Set) and returns the Class and Parameterized type,
  if any.
  
  @param type
  the Collection type
  @return an array of Class objects with two elements. The first element will contain the raw
  type of the collection and the second will contain the parameterized type. If the
  collection declaration is not parameterized, the second element in the array is set to
  <code>null</code>.