我正在从日食中得到警告

Type safety: The expression of type TreeItem[] needs unchecked conversion to conform to TreeItem<AppleItem>[]

在使用时:

TreeItem<AppleItem>[] friends = item.getChildren().toArray(new TreeItem[0]);


我不想使用@uncheck或我不想使用循环一一插入。有没有办法做到这一点?

显然getChildren返回一个ArrayListArrayList<TreeItem<AppleItem>>

提前致谢。

最佳答案

不,没有未经检查的演员表就无法做到。 @Ivaylo的解决方案也不会挽救您。

07-24 09:45
查看更多