• <legend id='kiBHC'><style id='kiBHC'><dir id='kiBHC'><q id='kiBHC'></q></dir></style></legend>

    <small id='kiBHC'></small><noframes id='kiBHC'>

        <bdo id='kiBHC'></bdo><ul id='kiBHC'></ul>
      <i id='kiBHC'><tr id='kiBHC'><dt id='kiBHC'><q id='kiBHC'><span id='kiBHC'><b id='kiBHC'><form id='kiBHC'><ins id='kiBHC'></ins><ul id='kiBHC'></ul><sub id='kiBHC'></sub></form><legend id='kiBHC'></legend><bdo id='kiBHC'><pre id='kiBHC'><center id='kiBHC'></center></pre></bdo></b><th id='kiBHC'></th></span></q></dt></tr></i><div id='kiBHC'><tfoot id='kiBHC'></tfoot><dl id='kiBHC'><fieldset id='kiBHC'></fieldset></dl></div>
      <tfoot id='kiBHC'></tfoot>

        转换列表&lt;整数&gt;列出&lt;字符串&

        时间:2023-10-01
      1. <i id='o2qhD'><tr id='o2qhD'><dt id='o2qhD'><q id='o2qhD'><span id='o2qhD'><b id='o2qhD'><form id='o2qhD'><ins id='o2qhD'></ins><ul id='o2qhD'></ul><sub id='o2qhD'></sub></form><legend id='o2qhD'></legend><bdo id='o2qhD'><pre id='o2qhD'><center id='o2qhD'></center></pre></bdo></b><th id='o2qhD'></th></span></q></dt></tr></i><div id='o2qhD'><tfoot id='o2qhD'></tfoot><dl id='o2qhD'><fieldset id='o2qhD'></fieldset></dl></div>

            <bdo id='o2qhD'></bdo><ul id='o2qhD'></ul>
          • <tfoot id='o2qhD'></tfoot>
                <tbody id='o2qhD'></tbody>
              1. <legend id='o2qhD'><style id='o2qhD'><dir id='o2qhD'><q id='o2qhD'></q></dir></style></legend>

                <small id='o2qhD'></small><noframes id='o2qhD'>

                  本文介绍了转换列表&lt;整数&gt;列出&lt;字符串&gt;的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  我有一个整数列表,List,我想将所有整数对象转换为字符串,从而完成一个新的List<String>代码>.

                  I have a list of integers, List<Integer> and I'd like to convert all the integer objects into Strings, thus finishing up with a new List<String>.

                  当然,我可以创建一个新的 List<String> 并循环遍历每个整数调用 String.valueOf() 的列表,但我想知道是否有一种更好的(阅读:更自动化)的方法?

                  Naturally, I could create a new List<String> and loop through the list calling String.valueOf() for each integer, but I was wondering if there was a better (read: more automatic) way of doing it?

                  推荐答案

                  据我所知,迭代和实例化是唯一的方法.类似的东西(对于其他人可能的帮助,因为我相信你知道如何做到这一点):

                  As far as I know, iterate and instantiate is the only way to do this. Something like (for others potential help, since I'm sure you know how to do this):

                  List<Integer> oldList = ...
                  /* Specify the size of the list up front to prevent resizing. */
                  List<String> newList = new ArrayList<>(oldList.size());
                  for (Integer myInt : oldList) { 
                    newList.add(String.valueOf(myInt)); 
                  }
                  

                  这篇关于转换列表&lt;整数&gt;列出&lt;字符串&gt;的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                  上一篇:为什么 == 与 Integer.valueOf(String) 的比较对 127 和 下一篇:四舍五入将其转换为 int (java)

                  相关文章

                  最新文章

                • <tfoot id='kaaXv'></tfoot>

                    <bdo id='kaaXv'></bdo><ul id='kaaXv'></ul>
                • <i id='kaaXv'><tr id='kaaXv'><dt id='kaaXv'><q id='kaaXv'><span id='kaaXv'><b id='kaaXv'><form id='kaaXv'><ins id='kaaXv'></ins><ul id='kaaXv'></ul><sub id='kaaXv'></sub></form><legend id='kaaXv'></legend><bdo id='kaaXv'><pre id='kaaXv'><center id='kaaXv'></center></pre></bdo></b><th id='kaaXv'></th></span></q></dt></tr></i><div id='kaaXv'><tfoot id='kaaXv'></tfoot><dl id='kaaXv'><fieldset id='kaaXv'></fieldset></dl></div>

                  1. <small id='kaaXv'></small><noframes id='kaaXv'>

                    <legend id='kaaXv'><style id='kaaXv'><dir id='kaaXv'><q id='kaaXv'></q></dir></style></legend>