List<String>和String相互转换

List<String>转String 

String Message="";
for (String msg : message) {
Message = Message.concat(msg);
}

  

String转List<String>

import java.util.ArrayList;
import java.util.List;
 
public class Str {
    public static void main(String[] args) {
        String s = "64,127,248,569";
        String d[] = s.split(",");
        List<String> list = new ArrayList<String>();
         
        for (int i = 0; i < d.length; i++) {
        list.add(d[i]);
             
            }
        System.out.println(list);
    }
}

  

posted @ 2016-03-09 11:35  Lost blog  阅读(1913)  评论(0编辑  收藏  举报