public class Test {
public static void main(String[] args) throws ParseException {
JSONObject json1 = JSONObject.fromObject("{}");
json1.put("a", "a1");
json1.put("b", "b1");
JSONObject json2 = JSONObject.fromObject("{}");
json2.put("c", "c1");
json2.put("d", "d1");
List<String>list=new ArrayList<String>();
list.add(json1.toString());
list.add(json2.toString());
String str = org.apache.commons.lang.StringUtils.join(list,"#");
System.out.println("liststr="+list);
List<String> resultlist = new ArrayList<String>(Arrays.asList(str.split("#")));
System.out.println("list="+resultlist);
}
}
list与字符串互转
最新推荐文章于 2024-06-30 03:41:53 发布