If you by passed parsing json with a library and you have a string separated that was provided to you by a vendor, the snippets below will show you how to separate the string in a collection. A colon is a punctuation mark (:) indicating. This example follows similar approach found in parse string on comma.
Straight up Java
Using java's String.split method passing a regex will return an array of strings computed by splitting the original on a colon.
Producing a stream of strings then applying a java 8 function to the elements will produce an Arraylist of String arrays. Calling the
flatmap will combine each array into a single stream by flattening it. Finally we will transform stream into arraylist.
Using guava's splitter 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.
Splits the provided text into an array, separators specified. This is an alternative to using StringTokenizer.