“`” 数组转 List:使用 Arrays. asList(array) 进行转换。

List 转数组:使用 List 自带的 toArray() 方法。

代码示例:

<pre><code>// list to arrayList<String> list = new ArrayList<String>();list. add(""面试哥"");list. add(""的网站"");list. toArray();// array to listString[] array = new String[]{""面试哥"",""的网站""};Arrays. asList(array);</code></pre>

 

<pre><code> "“`

Was this helpful?

0 / 0

发表回复 0

Your email address will not be published.