public static final class Joiner.MapJoiner extends java.lang.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 java.lang.Appendable> |
appendTo(A appendable,
java.lang.Iterable<? extends java.util.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 java.lang.Appendable> |
appendTo(A appendable,
java.util.Iterator<? extends java.util.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 java.lang.Appendable> |
appendTo(A appendable,
java.util.Map<?,?> map)
Appends the string representation of each entry of
map , using the previously
configured separator and key-value separator, to appendable . |
java.lang.StringBuilder |
appendTo(java.lang.StringBuilder builder,
java.lang.Iterable<? extends java.util.Map.Entry<?,?>> entries)
Appends the string representation of each entry in
entries , using the previously
configured separator and key-value separator, to builder . |
java.lang.StringBuilder |
appendTo(java.lang.StringBuilder builder,
java.util.Iterator<? extends java.util.Map.Entry<?,?>> entries)
Appends the string representation of each entry in
entries , using the previously
configured separator and key-value separator, to builder . |
java.lang.StringBuilder |
appendTo(java.lang.StringBuilder builder,
java.util.Map<?,?> map)
Appends the string representation of each entry of
map , using the previously
configured separator and key-value separator, to builder . |
java.lang.String |
join(java.lang.Iterable<? extends java.util.Map.Entry<?,?>> entries)
Returns a string containing the string representation of each entry in
entries , using
the previously configured separator and key-value separator. |
java.lang.String |
join(java.util.Iterator<? extends java.util.Map.Entry<?,?>> entries)
Returns a string containing the string representation of each entry in
entries , using
the previously configured separator and key-value separator. |
java.lang.String |
join(java.util.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(java.lang.String nullText)
Returns a map joiner with the same behavior as this one, except automatically substituting
nullText for any provided null keys or values. |
@CanIgnoreReturnValue public <A extends java.lang.Appendable> A appendTo(A appendable, java.util.Map<?,?> map) throws java.io.IOException
map
, using the previously
configured separator and key-value separator, to appendable
.java.io.IOException
@CanIgnoreReturnValue public java.lang.StringBuilder appendTo(java.lang.StringBuilder builder, java.util.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
.@Beta @CanIgnoreReturnValue public <A extends java.lang.Appendable> A appendTo(A appendable, java.lang.Iterable<? extends java.util.Map.Entry<?,?>> entries) throws java.io.IOException
entries
, using the previously
configured separator and key-value separator, to appendable
.java.io.IOException
@Beta @CanIgnoreReturnValue public <A extends java.lang.Appendable> A appendTo(A appendable, java.util.Iterator<? extends java.util.Map.Entry<?,?>> parts) throws java.io.IOException
entries
, using the previously
configured separator and key-value separator, to appendable
.java.io.IOException
@Beta @CanIgnoreReturnValue public java.lang.StringBuilder appendTo(java.lang.StringBuilder builder, java.lang.Iterable<? extends java.util.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 @CanIgnoreReturnValue public java.lang.StringBuilder appendTo(java.lang.StringBuilder builder, java.util.Iterator<? extends java.util.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
.public java.lang.String join(java.util.Map<?,?> map)
map
, using the
previously configured separator and key-value separator.@Beta public java.lang.String join(java.lang.Iterable<? extends java.util.Map.Entry<?,?>> entries)
entries
, using
the previously configured separator and key-value separator.@Beta public java.lang.String join(java.util.Iterator<? extends java.util.Map.Entry<?,?>> entries)
entries
, using
the previously configured separator and key-value separator.public Joiner.MapJoiner useForNull(java.lang.String nullText)
nullText
for any provided null keys or values.Copyright © 2010–2021 JBoss by Red Hat. All rights reserved.