code: protected <C extends Map<?, ?>> C createMap(Class<C> type, Integer capacity) {
  
      if (type.isInterface()) {
        MapFactory<C> factory = getMapFactory(type);
        if (factory == null) {
          throw new UnknownCollectionInterfaceException(type);
        }
        if (capacity == null) {
          return factory.createGeneric();
        } else {
          return factory.createGeneric(capacity.intValue());
        }
      } else if (Modifier.isAbstract(type.getModifiers())) {
        Class<? extends Map> collectionInterface = findMapInterface(type);
        return (C) createMap(collectionInterface, capacity);
      }
  
      try {
        if (capacity != null) {
          try {
            Constructor<C> constructor = type.getConstructor(CAPACITY_CONSTRUCTOR_ARGS);
            return constructor.newInstance(capacity);
          } catch (Exception e) {
            LOG.debug("Failed to create map via capacitory constructor.", e);
          }
        }
        return type.newInstance();
      } catch (Exception e) {
        throw new IllegalStateException("Failed to create collection of type: " + type, e);
      }
    }
docs: @see #create(Class, int)
  
  @param <C> is the generic type of the collection.
  @param type is the type of collection to create. This is either an interface ({@link java.util.List},
  {@link java.util.Set}, {@link java.util.Queue}, etc.) or a non-abstract implementation of a
  {@link Collection}.
  @param capacity is the initial capacity of the collection or {@code null} if unspecified.
  @return the new instance of the given {@code type}.