public static void main(String[] args) {
List<Integer> longString = new ArrayList<>();
longString.add(1);
longString.add(2);
longString.add(3);
longString.add(4);
longString.add(5);
longString.add(6);
System.out.println(org.apache.commons.lang3.StringUtils.strip(String.valueOf(longString),"[]"));
}
public static void main(String[] args) {
List<Integer> longString = new ArrayList<>();
longString.add(1);
longString.add(2);
longString.add(3);
longString.add(4);
longString.add(5);
longString.add(6);
StringBuffer stringBuffer = new StringBuffer();
longString.forEach(s->{
stringBuffer.append(s).append(",");
});
String substring = stringBuffer.substring(0, stringBuffer.length() - 1);
System.out.println(longString);
System.out.println(substring);
}
public static void main(String[] args) {
String str = "1,2,3,4,5,6";
System.out.println(java.util.Collections.singletonList(str));
}
public static void main(String[] args) {
String str = "1,2,3,4,5,6";
System.out.println( java.util.Arrays.asList(str.split(",")));
}
public static void main(String[] args) {
String longs = "1,2,3,4,5";
List<Long> longList =Arrays.stream(longs .split(",")).map(s->Long.parseLong(s.trim())).collect(Collectors.toList());
System.out.println(longList);
}
end--------------------------------------------