code: public static int getTypeVariablePosition(GenericDeclaration genericDeclartion, TypeVariable<?> typeVariable) {
          int position = -1;
          TypeVariable<?>[] typeVariableDeclarationParameters = genericDeclartion
                  .getTypeParameters();
  
          // Try to find the position of the type variable in the class
          for (int i = 0; i < typeVariableDeclarationParameters.length; i++) {
              if (typeVariableDeclarationParameters[i].equals(typeVariable)) {
                  position = i;
                  break;
              }
          }
  
          return position;
      }
docs: Tries to find the position of the given type variable in the type
  parameters of the given class. This method iterates through the type
  parameters of the given class and tries to find the given type variable
  within the type parameters. When the type variable is found, the position
  is returned, otherwise -1.
  
  @param genericDeclartion The generic declartion type in which to look for the type
  variable
  @param typeVariable      The type variable to look for in the given class type
  parameters
  @return The position of the given type variable within the type
  parameters of the given class if found, otherwise -1