docs: public static <T> Optional<Iterable<T>> convertCollection(Class<? extends Iterable<T>> iterableType, Collection<T> collection) {
          if (iterableType.isInstance(collection)) {
              return Optional.of(collection);
          }
          if (iterableType.equals(Set.class)) {
              return Optional.of(new HashSet<>(collection));
          }
          if (iterableType.equals(Queue.class)) {
              return Optional.of(new LinkedList<>(collection));
          }
          if (iterableType.equals(List.class)) {
              return Optional.of(new ArrayList<>(collection));
          }
          if (!iterableType.isInterface()) {
              try {
                  Constructor<? extends Iterable<T>> constructor = iterableType.getConstructor(Collection.class);
                  return Optional.of(constructor.newInstance(collection));
              } catch (Throwable e) {
                  return Optional.empty();
              }
          }
          return Optional.empty();
      }