Created
October 8, 2011 02:27
-
-
Save dtulig/1271761 to your computer and use it in GitHub Desktop.
Example of using Guava's MapSplitter
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
final String stringToSplit = "dave:123, john:314,, matt:989"; | |
final Map<String, String> splitKeyValues = Splitter.on(",") | |
.omitEmptyStrings() | |
.trimResults() | |
.withKeyValueSeparator(":") | |
.split(stringToSplit); | |
// Map Contents: {dave=123, john=314, matt=989} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment