Code Snippet

Just another Code Snippet site

[Guava] Tips

Split and trim a list of values :

Splitter split = Splitter.on(CharMatcher.anyOf(",;")).trimResults().omitEmptyStrings();
split .splitToList("1, 2,3,, 5");

Maven dependency :

<dependency>
    <groupId>com.google.guava</groupId>
    <artifactId>guava</artifactId>
    <version>19.0</version>
</dependency>


Leave a Reply

Your email address will not be published. Required fields are marked *