public class MultimapJoiner
extends java.lang.Object
Joiner
joins iterables and arrays. Like Joiner
,
it is thread-safe and immutable.
In contrast to using a Joiner.MapJoiner
in conjunction with Multimap
, the MultimapJoiner
allows to use
a custom joiner for the values of an entry.
Constructor and Description |
---|
MultimapJoiner(com.google.common.base.Joiner entryJoiner,
java.lang.String separator,
java.lang.String keyValueSeparator) |
Modifier and Type | Method and Description |
---|---|
<A extends java.lang.Appendable> |
appendTo(A appendable,
java.lang.Iterable<? extends java.util.Map.Entry<?,? extends java.util.Collection<?>>> 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.Map<?,? extends java.util.Collection<?>> map)
Appends the string representation of each entry of
map , using the previously configured separator and
key-value separator, to appendable . |
<A extends java.lang.Appendable> |
appendTo(A appendable,
com.google.common.collect.Multimap<?,?> 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<?,? extends java.util.Collection<?>>> 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<?,? extends java.util.Collection<?>> map)
Appends the string representation of each entry of
map , using the previously configured separator and
key-value separator, to builder . |
java.lang.StringBuilder |
appendTo(java.lang.StringBuilder builder,
com.google.common.collect.Multimap<?,?> 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<?,? extends java.util.Collection<?>>> 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(com.google.common.collect.Multimap<?,?> map)
Returns a string containing the string representation of each entry of
map , using the previously
configured separator and key-value separator. |
MultimapJoiner |
skipNulls() |
protected java.lang.CharSequence |
toString(java.lang.Object part) |
MultimapJoiner |
useForNull(java.lang.String nullText)
Returns a multimap joiner with the same behavior as this one, except automatically substituting
nullText for
any provided null keys or values. |
public MultimapJoiner(com.google.common.base.Joiner entryJoiner, java.lang.String separator, java.lang.String keyValueSeparator)
public <A extends java.lang.Appendable> A appendTo(A appendable, com.google.common.collect.Multimap<?,?> map) throws java.io.IOException
map
, using the previously configured separator and
key-value separator, to appendable
.java.io.IOException
public <A extends java.lang.Appendable> A appendTo(A appendable, java.util.Map<?,? extends java.util.Collection<?>> map) throws java.io.IOException
map
, using the previously configured separator and
key-value separator, to appendable
.java.io.IOException
public java.lang.StringBuilder appendTo(java.lang.StringBuilder builder, com.google.common.collect.Multimap<?,?> map)
map
, using the previously configured separator and
key-value separator, to builder
. Identical to appendTo(Appendable, Multimap)
, except that it
does not throw IOException
.public java.lang.StringBuilder appendTo(java.lang.StringBuilder builder, java.util.Map<?,? extends java.util.Collection<?>> 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 java.lang.String join(com.google.common.collect.Multimap<?,?> map)
map
, using the previously
configured separator and key-value separator.public <A extends java.lang.Appendable> A appendTo(A appendable, java.lang.Iterable<? extends java.util.Map.Entry<?,? extends java.util.Collection<?>>> entries) throws java.io.IOException
entries
, using the previously configured separator and
key-value separator, to appendable
.java.io.IOException
public java.lang.StringBuilder appendTo(java.lang.StringBuilder builder, java.lang.Iterable<? extends java.util.Map.Entry<?,? extends java.util.Collection<?>>> 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.lang.Iterable<? extends java.util.Map.Entry<?,? extends java.util.Collection<?>>> entries)
entries
, using the previously
configured separator and key-value separator.protected java.lang.CharSequence toString(java.lang.Object part)
public MultimapJoiner skipNulls()
public MultimapJoiner useForNull(java.lang.String nullText)
nullText
for
any provided null keys or values.