-
-
Save dfparker2002/9463653fe53a907c2a94bd54b77a3347 to your computer and use it in GitHub Desktop.
Example of using Guava's MapSplitter
This file contains 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