Package com.google.common.base
Class Joiner.MapJoiner
-
- com.google.common.base.Joiner.MapJoiner
-
- Enclosing class:
- Joiner
public static final class Joiner.MapJoiner extends
An object that joins map entries in the same manner asJoiner
joins iterables and arrays. LikeJoiner
, it is thread-safe and immutable.In addition to operating on
Map
instances,MapJoiner
can operate onMultimap
entries in two distinct modes:- To output a separate entry for each key-value pair, pass
multimap.entries()
to aMapJoiner
method that accepts entries as input, and receive output of the formkey1=A&key1=B&key2=C
. - To output a single entry for each key, pass
multimap.asMap()
to aMapJoiner
method that accepts a map as input, and receive output of the formkey1=[A, B]&key2=C
.
- Since:
- 2.0
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description <A extends >
AappendTo(A appendable, <? extends <?,?>> entries)
Appends the string representation of each entry inentries
, using the previously configured separator and key-value separator, toappendable
.<A extends >
AappendTo(A appendable, <? extends <?,?>> parts)
Appends the string representation of each entry inentries
, using the previously configured separator and key-value separator, toappendable
.<A extends >
AappendTo(A appendable, <?,?> map)
Appends the string representation of each entry ofmap
, using the previously configured separator and key-value separator, toappendable
.builder, <? extends <?,?>> entries)
Appends the string representation of each entry inentries
, using the previously configured separator and key-value separator, tobuilder
.builder, <? extends <?,?>> entries)
Appends the string representation of each entry inentries
, using the previously configured separator and key-value separator, tobuilder
.builder, <?,?> map)
Appends the string representation of each entry ofmap
, using the previously configured separator and key-value separator, tobuilder
.<? extends <?,?>> entries)
Returns a string containing the string representation of each entry inentries
, using the previously configured separator and key-value separator.<? extends <?,?>> entries)
Returns a string containing the string representation of each entry inentries
, using the previously configured separator and key-value separator.<?,?> map)
Returns a string containing the string representation of each entry ofmap
, using the previously configured separator and key-value separator.Joiner.MapJoiner
nullText)
Returns a map joiner with the same behavior as this one, except automatically substitutingnullText
for any provided null keys or values.
-
-
-
Method Detail
-
appendTo
public <A extends > A appendTo(A appendable, <?,?> map) throws
Appends the string representation of each entry ofmap
, using the previously configured separator and key-value separator, toappendable
.- Throws:
-
appendTo
public builder, <?,?> map)
Appends the string representation of each entry ofmap
, using the previously configured separator and key-value separator, tobuilder
. Identical to .
-
appendTo
@Beta public <A extends > A appendTo(A appendable, <? extends <?,?>> entries) throws
Appends the string representation of each entry inentries
, using the previously configured separator and key-value separator, toappendable
.- Throws:
- Since:
- 10.0
-
appendTo
@Beta public <A extends > A appendTo(A appendable, <? extends <?,?>> parts) throws
Appends the string representation of each entry inentries
, using the previously configured separator and key-value separator, toappendable
.- Throws:
- Since:
- 11.0
-
appendTo
@Beta public builder, <? extends <?,?>> entries)
Appends the string representation of each entry inentries
, using the previously configured separator and key-value separator, tobuilder
. Identical to .- Since:
- 10.0
-
appendTo
@Beta public builder, <? extends <?,?>> entries)
Appends the string representation of each entry inentries
, using the previously configured separator and key-value separator, tobuilder
. Identical to .- Since:
- 11.0
-
join
public <?,?> map)
Returns a string containing the string representation of each entry ofmap
, using the previously configured separator and key-value separator.
-
join
@Beta public <? extends <?,?>> entries)
Returns a string containing the string representation of each entry inentries
, using the previously configured separator and key-value separator.- Since:
- 10.0
-
join
@Beta public <? extends <?,?>> entries)
Returns a string containing the string representation of each entry inentries
, using the previously configured separator and key-value separator.- Since:
- 11.0
-
useForNull
public nullText)
Returns a map joiner with the same behavior as this one, except automatically substitutingnullText
for any provided null keys or values.
-
-