code: @SuppressWarnings("unchecked")
      protected <T> Collection<T> castCollectionToType(Class collectionType, Collection<T> converted) throws ConversionException {
          if (!Collection.class.isAssignableFrom(collectionType)) {
              throw new ConversionException("Collection type should extends collection" + collectionType);
          }
  
          if (collectionType.isInterface()) {
              if (collectionType.isAssignableFrom(Set.class)) {
                  return Collections.unmodifiableSet(new HashSet<>(converted));
              }
              if (collectionType.isAssignableFrom(List.class)) {
                  return Collections.unmodifiableList(new LinkedList<>(converted));
              }
              if (collectionType.isAssignableFrom(Collection.class)) {
                  return Collections.unmodifiableCollection(converted);
              }
              throw new ConversionException("Unsupported collection type " + collectionType);
          }
          try {
              Constructor constructor = collectionType.getConstructor(Collection.class);
              return (Collection<T>) constructor.newInstance(converted);
          } catch (Exception e) {
              throw new ConversionException("Could not create an instance of " + collectionType, e);
          }
      }
docs: Create an instance of specified collection with given element type.