com.google.common.base
Class Splitter.MapSplitter

java.lang.Object
  extended by com.google.common.base.Splitter.MapSplitter
Enclosing class:
Splitter

@Beta
public static final class Splitter.MapSplitter
extends Object

An object that splits strings into maps as Splitter splits iterables and lists. Like Splitter, it is thread-safe and immutable.

Since:
10.0

Method Summary
 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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

split

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.

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


Copyright © 2010-2011. All Rights Reserved.