public static final class Joiner.MapJoiner extends Object
Joiner joins iterables and arrays. Like
Joiner, it is thread-safe and immutable.
In addition to operating on Map instances, MapJoiner can operate on Multimap entries in two distinct modes:
multimap.entries() to a MapJoiner method that accepts entries as input, and receive output of the form key1=A&key1=B&key2=C. multimap.asMap() to a MapJoiner method that accepts a map as input, and receive output of the form key1=[A, B]&key2=C. | Modifier and Type | Method and Description |
|---|---|
<A extends Appendable |
appendTo(A appendable, Iterable
Appends the string representation of each entry in
entries, using the previously configured separator and key-value separator, to
appendable.
|
<A extends Appendable |
appendTo(A appendable, Iterator
Appends the string representation of each entry in
entries, using the previously configured separator and key-value separator, to
appendable.
|
<A extends Appendable |
appendTo(A appendable, Map
Appends the string representation of each entry of
map, using the previously configured separator and key-value separator, to
appendable.
|
StringBuilder |
appendTo(StringBuilder
Appends the string representation of each entry in
entries, using the previously configured separator and key-value separator, to
builder.
|
StringBuilder |
appendTo(StringBuilder
Appends the string representation of each entry in
entries, using the previously configured separator and key-value separator, to
builder.
|
StringBuilder |
appendTo(StringBuilder
Appends the string representation of each entry of
map, using the previously configured separator and key-value separator, to
builder.
|
String |
join(Iterable
Returns a string containing the string representation of each entry in
entries, using the previously configured separator and key-value separator.
|
String |
join(Iterator
Returns a string containing the string representation of each entry in
entries, using the previously configured separator and key-value separator.
|
String |
join(Map
Returns a string containing the string representation of each entry of
map, using the previously configured separator and key-value separator.
|
Joiner |
useForNull(String
Returns a map joiner with the same behavior as this one, except automatically substituting
nullText for any provided null keys or values.
|
public <A extends Appendable> A appendTo(A appendable, Map <? ,?> map) throws IOException
map, using the previously configured separator and key-value separator, to
appendable.
IOException
public StringBuilderappendTo(StringBuilder builder, Map <? ,?> map)
map, using the previously configured separator and key-value separator, to
builder. Identical to
appendTo(Appendable, Map), except that it does not throw
IOException.
public Stringjoin(Map <? ,?> map)
map, using the previously configured separator and key-value separator.
@Beta public <A extends Appendable> A appendTo(A appendable, Iterable <? extends Map .Entry <? ,?>> entries) throws IOException
entries, using the previously configured separator and key-value separator, to
appendable.
IOException
@Beta public <A extends Appendable> A appendTo(A appendable, Iterator <? extends Map .Entry <? ,?>> parts) throws IOException
entries, using the previously configured separator and key-value separator, to
appendable.
IOException
@Beta public StringBuilderappendTo(StringBuilder builder, Iterable <? extends Map .Entry <? ,?>> entries)
entries, using the previously configured separator and key-value separator, to
builder. Identical to
appendTo(Appendable, Iterable), except that it does not throw
IOException.
@Beta public StringBuilderappendTo(StringBuilder builder, Iterator <? extends Map .Entry <? ,?>> entries)
entries, using the previously configured separator and key-value separator, to
builder. Identical to
appendTo(Appendable, Iterable), except that it does not throw
IOException.
@Beta public Stringjoin(Iterable <? extends Map .Entry <? ,?>> entries)
entries, using the previously configured separator and key-value separator.
@Beta public Stringjoin(Iterator <? extends Map .Entry <? ,?>> entries)
entries, using the previously configured separator and key-value separator.
public Joiner.MapJoiner useForNull(String nullText)
nullText for any provided null keys or values.