我正在从日食中得到警告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
返回一个ArrayList
像ArrayList<TreeItem<AppleItem>>
提前致谢。
最佳答案
不,没有未经检查的演员表就无法做到。 @Ivaylo的解决方案也不会挽救您。