基本包装类的List 与 Set 实例对象转化为字符串

基本包装类的List 与 Set 实例对象转化为字符串

当 hello 为 空List时,hello.toString()为 "[]";当hello 不为空List时,hello.toString()为 "[1,2,3,44,2222]"之类的数据

hello为空或者不为空的情况下,通过kk.subString(1,kk.length()-1)均可得到正确的字符串:当hello为空时,得到的为空字符串,当hello不为空时,得到的是"1,2,3,44,22222"之类的字符串。

Set 和  List 类似

原文地址:https://www.cnblogs.com/maxiaoshuai/p/5740332.html