如何创建以下内容:
HashMap<String, Pair<Boolean, Object>> mHashMap = new HashMap();
我有以下内容:
ParameterizedTypeName subType = ParameterizedTypeName.get(Pair.class, Boolean.class, Object.class);
ParameterizedTypeName mainType = ParameterizedTypeName.get(HashMap.class, String.class, Pair.class);
builder.addField(
FieldSpec.builder(mainType, "mHashMap", Modifier.PRIVATE, Modifier.FINAL)
.initializer("new HashMap<>()")
.build()
);
我现在如何将 与 结合起来subType
以mainType
获得正确的mainType
?
我需要以下内容:
ParameterizedTypeName mainType = ParameterizedTypeName.get(HashMap.class, String.class, subType);