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,I extends Object & Iterable<? extends Map.Entry<?,?>> & Iterator<? extends Map.Entry<?,?>>> |
appendTo(A appendable,
I entries)
Deprecated.
use
appendTo(Appendable, Iterator) by casting entries to
Iterator<? extends Entry<?, ?>> , or better yet, by implementing only
Iterator and not Iterable . This method is scheduled for deletion
in June 2013. |
<A extends Appendable> |
appendTo(A appendable,
Iterable<? extends Map.Entry<?,?>> entries)
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<? extends Map.Entry<?,?>> parts)
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<?,?> map)
Appends the string representation of each entry of
map , using the previously
configured separator and key-value separator, to appendable . |
<I extends Object & Iterable<? extends Map.Entry<?,?>> & Iterator<? extends Map.Entry<?,?>>> |
appendTo(StringBuilder builder,
I entries)
Deprecated.
use
appendTo(StringBuilder, Iterator) by casting entries to
Iterator<? extends Entry<?, ?>> , or better yet, by implementing only
Iterator and not Iterable . This method is scheduled for deletion
in June 2013. |
StringBuilder |
appendTo(StringBuilder builder,
Iterable<? extends Map.Entry<?,?>> entries)
Appends the string representation of each entry in
entries , using the previously
configured separator and key-value separator, to builder . |
StringBuilder |
appendTo(StringBuilder builder,
Iterator<? extends Map.Entry<?,?>> entries)
Appends the string representation of each entry in
entries , using the previously
configured separator and key-value separator, to builder . |
StringBuilder |
appendTo(StringBuilder builder,
Map<?,?> map)
Appends the string representation of each entry of
map , using the previously
configured separator and key-value separator, to builder . |
<I extends Object & Iterable<? extends Map.Entry<?,?>> & Iterator<? extends Map.Entry<?,?>>> |
join(I entries)
Deprecated.
use
join(Iterator) by casting entries to
Iterator<? extends Entry<?, ?>> , or better yet, by implementing only
Iterator and not Iterable . This method is scheduled for deletion
in June 2013. |
String |
join(Iterable<? extends Map.Entry<?,?>> entries)
Returns a string containing the string representation of each entry in
entries , using
the previously configured separator and key-value separator. |
String |
join(Iterator<? extends Map.Entry<?,?>> entries)
Returns a string containing the string representation of each entry in
entries , using
the previously configured separator and key-value separator. |
String |
join(Map<?,?> map)
Returns a string containing the string representation of each entry of
map , using the
previously configured separator and key-value separator. |
Joiner.MapJoiner |
useForNull(String nullText)
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 StringBuilder appendTo(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 String join(Map<?,?> map)
map
, using the
previously configured separator and key-value separator.@Beta @Deprecated public <A extends Appendable,I extends Object & Iterable<? extends Map.Entry<?,?>> & Iterator<? extends Map.Entry<?,?>>> A appendTo(A appendable, I entries) throws IOException
appendTo(Appendable, Iterator)
by casting entries
to
Iterator<? extends Entry<?, ?>>
, or better yet, by implementing only
Iterator
and not Iterable
. This method is scheduled for deletion
in June 2013.IOException
@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 @Deprecated public <I extends Object & Iterable<? extends Map.Entry<?,?>> & Iterator<? extends Map.Entry<?,?>>> StringBuilder appendTo(StringBuilder builder, I entries) throws IOException
appendTo(StringBuilder, Iterator)
by casting entries
to
Iterator<? extends Entry<?, ?>>
, or better yet, by implementing only
Iterator
and not Iterable
. This method is scheduled for deletion
in June 2013.IOException
@Beta public StringBuilder appendTo(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 StringBuilder appendTo(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 @Deprecated public <I extends Object & Iterable<? extends Map.Entry<?,?>> & Iterator<? extends Map.Entry<?,?>>> String join(I entries) throws IOException
join(Iterator)
by casting entries
to
Iterator<? extends Entry<?, ?>>
, or better yet, by implementing only
Iterator
and not Iterable
. This method is scheduled for deletion
in June 2013.IOException
@Beta public String join(Iterable<? extends Map.Entry<?,?>> entries)
entries
, using
the previously configured separator and key-value separator.@Beta public String join(Iterator<? extends Map.Entry<?,?>> entries)
entries
, using
the previously configured separator and key-value separator.@CheckReturnValue public Joiner.MapJoiner useForNull(String nullText)
nullText
for any provided null keys or values.Copyright © 2010-2013. All Rights Reserved.