code: public static Map<TypeVariable<?>, Type> getTypeArguments(final Type type, final Class<?> toClass) {
          return getTypeArguments(type, toClass, null);
      }
docs: <p>Gets the type arguments of a class/interface based on a subtype. For
  instance, this method will determine that both of the parameters for the
  interface {@link Map} are {@link Object} for the subtype
  {@link java.util.Properties Properties} even though the subtype does not
  directly implement the {@code Map} interface.</p>
  <p>This method returns {@code null} if {@code type} is not assignable to
  {@code toClass}. It returns an empty map if none of the classes or
  interfaces in its inheritance hierarchy specify any type arguments.</p>
  <p>A side effect of this method is that it also retrieves the type
  arguments for the classes and interfaces that are part of the hierarchy
  between {@code type} and {@code toClass}. So with the above
  example, this method will also determine that the type arguments for
  {@link java.util.Hashtable Hashtable} are also both {@code Object}.
  In cases where the interface specified by {@code toClass} is
  (indirectly) implemented more than once (e.g. where {@code toClass}
  specifies the interface {@link java.lang.Iterable Iterable} and
  {@code type} specifies a parameterized type that implements both
  {@link java.util.Set Set} and {@link java.util.Collection Collection}),
  this method will look at the inheritance hierarchy of only one of the
  implementations/subclasses; the first interface encountered that isn't a
  subinterface to one of the others in the {@code type} to
  {@code toClass} hierarchy.</p>
  
  @param type the type from which to determine the type parameters of
  {@code toClass}
  @param toClass the class whose type parameters are to be determined based
  on the subtype {@code type}
  @return a {@code Map} of the type assignments for the type variables in
  each type in the inheritance hierarchy from {@code type} to
  {@code toClass} inclusive.