说明:很遗憾,组装的时候只能遍历。

方法:

public static String listToString(List<String> list){
      if(list==null){
      return null;
   }
   StringBuilder result = new StringBuilder();
   boolean first = true;
   //第一个前面不拼接","
   for(String string :list) {
      if(first) {
         first=false;
      }else{
         result.append(",");
      }
      result.append(string);
   }
   return result.toString();
}
public static List<String> stringToList(String strs){
    String str[] = strs.split(",");
    return Arrays.asList(str);
}

 

参考:

http://blog.csdn.net/shareye1992/article/details/50036615

相关文章:

  • 2022-02-10
  • 2022-12-23
  • 2022-12-23
  • 2021-12-14
猜你喜欢
  • 2021-06-17
  • 2022-12-23
  • 2022-12-23
  • 2021-10-01
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案