Let's say you have a comma delimited file or a phrase that you want to divide each element on all the commas. This example will show how to parse a string on a comma using java, guava and apache commons. A similar example shows how to parse comma delimited string in groovy.
Straight up Java
Using java's core String.split function we will pass a regular expression that will return an array of strings computed by splitting the original on a comma.
Using guava's Splitter class we will parse a comma delimited string by passing a comma as a separator to the on method. Next we will call the splitToList function that will split the sequence into chunks and make them available via an ArrayList.
Apache Commons
This snippet will split text into an array using a comma as a separator using apache commons StringUtils.split.