String s1 = "hello|hihi";
String s2 = "hello|haha|||";
List<String> list = Splitter.on("|").splitToList(s1);
List<String> list2 = Splitter.on("|").splitToList(s2);
System.out.println(list);
System.out.println(list2);
输出结果为
[hello, hihi]
[hello, haha, , , ]
把字符串中 含有on 里边的元素切割掉 并且放到list中