日本不卡不码高清免费观看,久久国产精品久久w女人spa,黄色aa久久,三上悠亚国产精品一区二区三区

您的位置:首頁技術(shù)文章
文章詳情頁

Java 數(shù)組內(nèi)置函數(shù)toArray詳解

瀏覽:152日期:2022-08-09 16:36:20

java.util.List中的toArray函數(shù)

java.util.List<E> @NotNull public abstract <T> T[] toArray(@NotNull T[] a)Returns an array containing all of the elements in this list in proper sequence (from first to last element); the runtime type of the returned array is that of the specified array. If the list fits in the specified array, it is returned therein. Otherwise, a new array is allocated with the runtime type of the specified array and the size of this list.If the list fits in the specified array with room to spare (i.e., the array has more elements than the list), the element in the array immediately following the end of the list is set to null. (This is useful in determining the length of the list only if the caller knows that the list does not contain any null elements.)Like the toArray() method, this method acts as bridge between array-based and collection-based APIs. Further, this method allows precise control over the runtime type of the output array, and may, under certain circumstances, be used to save allocation costs.Suppose x is a list known to contain only strings. The following code can be used to dump the list into a newly allocated array of String: String[] y = x.toArray(new String[0]); Note that toArray(new Object[0]) is identical in function to toArray().Overrides:toArray in interface CollectionParams:a ? the array into which the elements of this list are to be stored, if it is big enough; otherwise, a new array of the same runtime type is allocated for this purpose.Type parameters:<T> ? the runtime type of the array to contain the collectionReturns:an array containing the elements of this listThrows:ArrayStoreException ? if the runtime type of the specified array is not a supertype of the runtime type of every element in this listNullPointerException ? if the specified array is nullExternal annotations:Abstract method toArray: @org.jetbrains.annotations.NotNullParameter a: @org.jetbrains.annotations.NotNull

翻譯java.util.List @NotNull

public abstract T[] toArray(@NotNull T[] a)

返回一個包含列表中所有元素的數(shù)組(從第一個元素到最后一個元素);返回?cái)?shù)組的運(yùn)行時類型是指定數(shù)組的運(yùn)行時類型。如果列表適合指定的數(shù)組,則在其中返回該列表。否則,將使用指定數(shù)組的運(yùn)行時類型和該列表的大小分配一個新數(shù)組。

如果列表適合指定的有空間的數(shù)組(即,數(shù)組的元素比列表的多),則緊挨著列表末尾的數(shù)組中的元素被設(shè)為null。(只有當(dāng)調(diào)用者知道列表不包含任何空元素時,這在確定列表的長度時才有用。)

與toArray()方法一樣,該方法充當(dāng)基于數(shù)組和基于集合的api之間的橋梁。此外,這種方法允許精確控制輸出數(shù)組的運(yùn)行時類型,在某些情況下,可以用于節(jié)省分配成本。

假設(shè)x是一個只包含字符串的列表。下面的代碼可以用來將列表轉(zhuǎn)儲到一個新分配的String數(shù)組中:

String[] y = x.toArray(new String[0]);

注意toArray(新對象[0])在函數(shù)中與toArray()相同。

覆蓋:

toArray在接口集合

參數(shù):

A -如果列表足夠大,則存放列表中所有元素的數(shù)組;否則,將為此目的分配相同運(yùn)行時類型的新數(shù)組。

類型參數(shù):

-包含集合的數(shù)組的運(yùn)行時類型

返回:

一個包含此列表元素的數(shù)組

拋出:

如果指定數(shù)組的運(yùn)行時類型不是這個列表中每個元素的運(yùn)行時類型的超類型,則會產(chǎn)生ArrayStoreException異常

NullPointerException -如果指定的數(shù)組為空

外部注釋:

抽象方法:@org.jetbrains.annotations.NotNull

參數(shù):@org.jetbrains.annotations.NotNull

public static void main(String[] args) { List<Double> asList = new ArrayList<Double>() {//使用匿名內(nèi)部類來初始化。{ add(35.6); add(3.2); add(90.);} }; Double []sumVenderNumArray = new Double[]{333333.34,999.9,93.45,23.4,33.}; Double [] sumVenderNumNum = asList.toArray(sumVenderNumArray); System.out.println(JSONObject.toJSONString(sumVenderNumNum));}

運(yùn)行結(jié)果:

Java 數(shù)組內(nèi)置函數(shù)toArray詳解

到此這篇關(guān)于Java 數(shù)組內(nèi)置函數(shù)toArray詳解的文章就介紹到這了,更多相關(guān)Java toArray解析內(nèi)容請搜索好吧啦網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持好吧啦網(wǎng)!

標(biāo)簽: Java
相關(guān)文章:
日本不卡不码高清免费观看,久久国产精品久久w女人spa,黄色aa久久,三上悠亚国产精品一区二区三区
久草免费在线视频| 日韩和欧美一区二区| 国产精品日本一区二区三区在线 | 国产香蕉精品| 国产区精品区| 国产精品一页| 精品国产乱码久久久| 精品一区二区三区中文字幕视频| 欧美激情麻豆| 黑森林国产精品av| 久久中文字幕二区| 亚洲激情中文| 天堂va蜜桃一区二区三区| 欧美午夜精彩| 亚洲综合国产| 久久精品99国产精品| 国产精品高清一区二区| 久久精品一区二区三区中文字幕| 欧美国产极品| 欧美成人基地| 99成人在线| 日韩精品成人在线观看| 麻豆极品一区二区三区| 国产超碰精品| 亚洲中午字幕| 国产日韩欧美三级| 超碰在线99| 女人av一区| 久久高清一区| 国产精品一区高清| 私拍精品福利视频在线一区| 国产视频一区三区| 欧美日韩精品一区二区三区视频 | 日本久久黄色| 99久久久久国产精品| 伊人久久亚洲| 国产精品久久久一区二区| 日本一区二区高清不卡| 久久国产亚洲| 日韩中出av| 色黄视频在线观看| 亚洲一区二区日韩| 国产一区二区三区四区| 亚洲资源av| 欧美激情福利| 婷婷综合社区| 国产精品资源| 日韩视频网站在线观看| 日av在线不卡| av资源中文在线| 亚洲麻豆一区| 日本午夜大片a在线观看| 在线精品一区二区| 欧美国产一级| 日韩精品1区2区3区| 日韩欧美少妇| 欧美亚洲一区二区三区| 久久精品官网| 国产精品免费99久久久| 九一成人免费视频| 欧美成人精品一级| 亚洲一区黄色| 国产精品久久久久77777丨| 国产综合欧美| 麻豆国产精品777777在线| 亚洲一级在线| 国产欧美一区二区三区精品酒店 | 最新国产拍偷乱拍精品| 欧美一区久久| 欧美特黄一级| 三上亚洲一区二区| 日本午夜精品视频在线观看| 精精国产xxxx视频在线野外 | 日韩av二区在线播放| 欧美亚洲激情| 久久av网站| 一区二区三区四区日韩| 一本大道色婷婷在线| 国产日本久久| 免费成人av在线播放| 日韩欧美自拍| 国产精品地址| 亚洲精品看片| 自拍日韩欧美| 久久久一二三| 色婷婷亚洲mv天堂mv在影片| 国产图片一区| 日韩影院免费视频| 亚洲一本视频| 成人av三级| 国产精品亚洲欧美一级在线| 石原莉奈在线亚洲二区| 欧美日韩精品免费观看视欧美高清免费大片 | 久久免费福利| 日韩免费精品| 宅男噜噜噜66国产日韩在线观看| 亚洲深夜视频| 国产中文字幕一区二区三区| 国产麻豆精品久久| 日韩超碰人人爽人人做人人添| 国产视频久久| 欧美大黑bbbbbbbbb在线| 日韩欧美不卡| 日韩.com| 国产成年精品| 久久只有精品| 久久精品亚洲一区二区| 国产视频一区二| 视频一区日韩精品| 亚洲伊人影院| 日韩专区一卡二卡| 黄色亚洲在线| 1024精品久久久久久久久| 性感美女一区二区在线观看| 日本精品黄色| 色在线中文字幕| 深夜视频一区二区| 日韩国产一区二区三区| 伊伊综合在线| av在线日韩| 播放一区二区| 亚洲国产专区校园欧美| 亚洲韩日在线| 国产二区精品| 亚洲在线网站| 国产一级久久| 综合色一区二区| 蜜臀av亚洲一区中文字幕| 蜜臀av在线播放一区二区三区| 免费在线观看精品| 日韩欧美在线精品| 国产亚洲久久| 久久精品国产999大香线蕉| 精品久久91| 不卡福利视频| 欧美特黄a级高清免费大片a级| 国产精品日韩欧美一区| 美女国产精品| 婷婷综合电影| 国产精品日韩精品在线播放| 国产精品一区二区美女视频免费看| 国产九一精品| 国产精品久久观看| 中文字幕系列一区| 国产精品88久久久久久| 久久一二三区| 蜜桃久久久久久| 欧美日韩中出| 国内精品亚洲| 成人欧美一区二区三区的电影| 国产videos久久| 欧美日韩免费看片| 欧美天堂亚洲电影院在线观看| 天堂va蜜桃一区二区三区| 91av一区| 老司机免费视频一区二区三区| 成人欧美一区二区三区的电影| 欧美 日韩 国产精品免费观看| 国产亚洲永久域名| 日本少妇精品亚洲第一区| 国产精品三p一区二区| 91欧美日韩| 国产模特精品视频久久久久| 日本一区免费网站| 美女久久久久久| 日韩成人亚洲| 免费一区二区视频| 国产欧美日韩视频在线| 国产精品蜜芽在线观看| 欧美 日韩 国产一区二区在线视频| 婷婷成人在线| 免费在线观看精品| 国产精品一区二区av交换 | 久久一区欧美| 99久久婷婷| 亚洲免费福利一区| 精品理论电影在线| 亚洲免费高清| 91亚洲无吗| 日韩久久精品| 涩涩涩久久久成人精品| 福利一区视频| 妖精视频成人观看www| 日本中文字幕一区二区| 久久免费福利| 美女国产精品| 韩国一区二区三区视频| 欧美网站在线| 国产精品欧美三级在线观看| 91精品在线观看国产| 日韩精品欧美大片| 欧美日韩视频网站| 亚洲日本欧美| 六月婷婷综合| 日韩精品第二页| 亚洲天堂黄色| 久久不见久久见免费视频7 | 国产极品模特精品一二| 在线日韩欧美| 国产精品一级|