In Java 8 you can use String.join()
like following:
Collection<String> elements = ....;
String result = String.join(", ", elements);
More Related Contents:
- How can I convert byte size into a human-readable format in Java?
- Http Basic Authentication in Java using HttpClient?
- What does the arrow operator, ‘->’, do in Java?
- Getting NoClassDefFoundError when using common.lang.StringUtils in android java code?
- How can I get an HTTP response body as a string?
- How to Serialize a list in java?
- Apache Commons equals/hashCode builder [closed]
- How to send java.util.logging to log4j?
- How can I generate a list or array of sequential integers in Java?
- Range of valid character for a base 64 encoding
- Lightweight JDBC helper library alternative to Apache Commons DbUtils [closed]
- Google Guava vs. Apache Commons [closed]
- Logging framework incompatibility
- Bi-directional Map in Java? [duplicate]
- Map that could be iterated in the order of values
- Apache Commons Net FTPClient and listFiles()
- tomcat-dbcp vs commons-dbcp
- How to fetch parameters when using the Apache Commons CLI library
- Copy POJO content from one bean to another
- Does Apache Commons HttpClient support GZIP?
- How to add parameters to a HTTP GET request in Android?
- how to convert image to byte array in java? [duplicate]
- JPA/Hibernate Native Queries do not recognize Parameters
- Java BigDecimal: Round to the nearest whole value
- How do I set Java’s min and max heap size through environment variables?
- Populating jTable using database data
- Is it possible to “add” to classpath dynamically in java?
- Print in bold on a terminal
- Differences between new Integer(123), Integer.valueOf(123) and just 123
- How to use comparison operators like >, =, < on BigDecimal