在java
Converting using toArray() MethodThe
toArray() method is a convenient way to convert an ArrayList
array = list.toArray(new String[0]);In the above code, toArray() method takes an empty String array as an argument. As a result, a new String[] array is created with the same length as the ArrayList
ExampleConsider the following example:
Listdame>的。調用list = ...; String[] array = list.toArray(new String[0]);
toarray()方法,傳遞一個空字符串數組,結果存儲在 StringArray
現在包含元素“ Android”和“ Apple”。 [&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& && && &&華氏[&& && &&華如果傳遞的數組具有足夠的大小以容納數組免責聲明: 提供的所有資源部分來自互聯網,如果有侵犯您的版權或其他權益,請說明詳細緣由並提供版權或權益證明然後發到郵箱:[email protected] 我們會在第一時間內為您處理。
Copyright© 2022 湘ICP备2022001581号-3