Download commons-lang3-3.0.1.jar.
https://mvnrepository.com/artifact/
org.apache.commons/commons-lang3/3.0.1
|
For maven:
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>3.0.1</version>
</dependency>
|
import
java.util.ArrayList;
import java.util.List;
import
org.apache.commons.lang3.StringUtils;
public class Test {
public static void main(String[]
args) {
List<String> list = new
ArrayList<String>();
list.add("less");
list.add("talk");
list.add("more");
list.add("code");
System.out.println(StringUtils.join(list,
",
"));
}
}
|
OUTPUT:
less, talk, more,
code
|
No comments:
Post a Comment