public static List<TypeRef<?>> getTypeArguments(TypeRef typeRef) {
    if (typeRef.getType() instanceof ParameterizedType) {
      ParameterizedType parameterizedType = (ParameterizedType) typeRef.getType();
      return Arrays.stream(parameterizedType.getActualTypeArguments())
          .map(TypeRef::of)
          .collect(Collectors.toList());
    } else {
      return new ArrayList<>();
    }
  }
@Test
  public void getTypeArguments() {
    TypeRef<Tuple2<String, Map<String, Integer>>> typeRef =
        new TypeRef<Tuple2<String, Map<String, Integer>>>() {};
    assertEquals(TypeUtils.getTypeArguments(typeRef).size(), 2);
  }