0

ジェネリック HashTable を作成しようとすると、次のエラーが発生します。

The method put(String, capture#2-of ?) in the type Hashtable<String,capture#2-of ?> is not applicable for the arguments (String, int)

次のような HashTable が必要です。 HashTable<String, HashTable<String, AnyWrapperType>>

by AnyWrapperType i mean it could be Integer or String or Character or Boolean

に使用?しましAnyWrapperTypeたが、エラーが発生しました。

私はまた、私が間違っていたことを知っているところからリンクをたどりましたが、道を見つけることができました.

    Hashtable<String, Hashtable<String, String>> paramTocol = new Hashtable<>();

    if (standard != null && (!standard.isEmpty())) {
        Hashtable<String, String> temp = new Hashtable<>();
        temp.put(Appconstants.Col_studentinfo_S_Class,
                AvailableClass.getValueByName(standard));
        paramTocol.put("standard", temp);
    }
    if (section != null && (!section.isEmpty())) {
        Hashtable<String, String> temp = new Hashtable<>();
        temp.put(Appconstants.Col_studentinfo_S_Section, section);

        paramTocol.put("section", temp);
    }

standard is Integerここでは、データベース内 の の実際の値とに対応する値section is charです。これらの値はすべて文字列として与えられ、それらを HashTable に格納する必要があるため、これらすべての値を保持する生のハッシュテーブルが必要です。どのタイプもユーザー定義ではありません

4

1 に答える 1