mysql中数组转list,Arrays.asList(T... a) 不转换基本类型数组值为list
生活随笔
收集整理的這篇文章主要介紹了
mysql中数组转list,Arrays.asList(T... a) 不转换基本类型数组值为list
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
隨手總結一下,數組轉換為list總結
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));
輸出結果:
[I: [[I@35ce36]
[Ljava.lang.String;: [srt1, srt2, srt3, srt4]
Arrays.asList(T... a),其中的參數a,若為對象類型的數組,該方法將會把數組中的每個元素取出來,放在list中返回;
若a為基本類型的數組,該方法將會把a對應的toString()返回的值作為list的元素,并返回該list
總結
以上是生活随笔為你收集整理的mysql中数组转list,Arrays.asList(T... a) 不转换基本类型数组值为list的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: php.ini用哪个,php.ini:哪
- 下一篇: Win10系统hosts文件不见了的解决