Splitter withKeyValueSeparator(char separator) method | Guava | Java
The withKeyValueSeparator(char separator) method of Guava’s Splitter Class accepts a mandatory parameter separator and splits entries into keys and values using this separator.
public Splitter.MapSplitter withKeyValueSeparator(char separator)
Parameters: The method accepts a parameter separator and splits entries into keys and values using this separator.
Return Value: The method returns a MapSplitter which splits entries based on this splitter.
Note: We pass the separator within pairs to this method. The on() method receives the separator between pairs of keys and values.
Below examples illustrate the implementation of withKeyValueSeparator() method of Guava’s Splitter class:
Data Structures -> Coding Sports -> Football Capital -> Delhi
First -> I Second -> II Third -> III Fourth -> IV
Attention reader! Don’t stop learning now. Get hold of all the important Java Foundation and Collections concepts with the Fundamentals of Java and Java Collections Course at a student-friendly price and become industry ready. To complete your preparation from learning a language to DS Algo and many more, please refer Complete Interview Preparation Course.