次のコードを使用してHashMap<String, String
、パーセルからタイプ >のマップを読み取ります。
in.readHashMap(HashMap.class.getClassLoader());
これは問題なく動作するようですが、次の警告が表示されます。
Type safety: The expression of type HashMap needs unchecked conversion to conform to Map<String,String>
これを行う「正しい」方法はありますか?別のクラスローダーを使用しますか? それとも、私はただ行くべき@SuppressWarnings("unchecked"
ですか?)?