Splitter is a utility class that is offering roughly speaking the opposite of what the
Joiner utility class does.
You can have a read at my previous quick article about Guava Joiner.
Splitter is offering similar look-and-feel as
on method serves as a static factory method, subsequent method calls are following the builder pattern returning a wrapped
this (therefore need to be packed prior the final
split method call). Finally it doesn’t try to be complicated returning an
Strings. It is aspiring in replacing the usage of
Its usage when we want to get back an
Strings looks like:
When we want to perform the operation retrieving a
Map out of its
In this instance the call to
withKeyValueSeparator is yielding a
Splitter.MapSplitter inner class that is adding the map context to the splitter.