Class Splitter.MapSplitter

  • Enclosing class:
    Splitter

    @Beta
    public static final class Splitter.MapSplitter
    extends 
    An object that splits strings into maps as Splitter splits iterables and lists. Like Splitter, it is thread-safe and immutable. The common way to build instances is by providing an additional key-value separator to Splitter.
    Since:
    10.0
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      <,​>  sequence)
      Splits sequence into substrings, splits each substring into an entry, and returns an unmodifiable map with each of the entries.
      • Methods inherited from class java.lang.

        , , , , , , , , , ,
    • Method Detail

      • split

        public <,​>  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.

        Throws:
        - if the specified sequence does not split into valid map entries, or if there are duplicate keys