Modifier and Type | Method and Description |
---|---|
Map<String,String> |
split(CharSequence sequence)
Splits
sequence into substrings, splits each substring into an entry, and returns an unmodifiable map with each of the entries. |
@CheckReturnValue public Map<String,String> split(CharSequence sequence)
Splits sequence
into substrings, splits each substring into an entry, and returns an unmodifiable map with each of the entries. For example, Splitter.on(‘;’).trimResults().withKeyValueSeparator(“=>”) .split(“a=>b ; c=>b”)
will return a mapping from "a"
to "b"
and "c"
to b
.
The returned map preserves the order of the entries from sequence
.
IllegalArgumentException
- if the specified sequence does not split into valid map entries, or if there are duplicate keys