mysql中数组转list,Arrays.asList(T... a) 不转换基本类型数组值为list
生活随笔
收集整理的這篇文章主要介紹了
mysql中数组转list,Arrays.asList(T... a) 不转换基本类型数组值为list
小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.
隨手總結(jié)一下,數(shù)組轉(zhuǎn)換為list總結(jié)
int[] a1 = new int[] { 1, 2, 3, 4 };
String[] a2 = new String[] { "srt1", "srt2", "srt3", "srt4" };
System.out.println(a1.getClass().getName() + ": " + Arrays.asList(a1));
System.out.println(a2.getClass().getName() + ": " + Arrays.asList(a2));
輸出結(jié)果:
[I: [[I@35ce36]
[Ljava.lang.String;: [srt1, srt2, srt3, srt4]
Arrays.asList(T... a),其中的參數(shù)a,若為對象類型的數(shù)組,該方法將會把數(shù)組中的每個元素取出來,放在list中返回;
若a為基本類型的數(shù)組,該方法將會把a(bǔ)對應(yīng)的toString()返回的值作為list的元素,并返回該list
總結(jié)
以上是生活随笔為你收集整理的mysql中数组转list,Arrays.asList(T... a) 不转换基本类型数组值为list的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: php.ini用哪个,php.ini:哪
- 下一篇: Win10系统hosts文件不见了的解决