gpt4 book ai didi

java - 对泛型类型 SparseArray 的引用应该参数化

转载 作者:行者123 更新时间:2023-12-01 18:49:49 24 4
gpt4 key购买 nike

我尝试用谷歌搜索这个警告,似乎找到了其他警告,但似乎有点不对劲。

Type safety: The method put(int, Object) belongs to the raw type SparseArray. References to generic type SparseArray should be parameterized

有人可以向我解释一下这个警告吗?

最佳答案

SparseArrayJava generics一起工作。理想情况下,您应该将其声明为 SparseArray<WhateverYourValueClassIs>然后存储 WhateverYourValueClassIs 的实例通过put() .

关于java - 对泛型类型 SparseArray<E> 的引用应该参数化,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16216456/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com