0

Eclipseから警告が表示されます

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またはループを使って1つずつ挿入したくない。これを行う方法はありますか?

どうやらいいねをgetChildren返すArrayListArrayList<TreeItem<AppleItem>>

前もって感謝します。

4

1 に答える 1

1

いいえ、チェックされていないキャストなしでそれを行う方法はありません。@Ivayloのソリューションでも、キャストからあなたを救うことはできません。

于 2013-02-15T17:07:43.990 に答える