public class MultimapJoiner extends 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,
String separator,
String keyValueSeparator) |
| Modifier and Type | Method and Description |
|---|---|
<A extends Appendable> |
appendTo(A appendable,
Iterable<? extends Map.Entry<?,? extends Collection<?>>> 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,
Map<?,? extends Collection<?>> map)
Appends the string representation of each entry of
map, using the previously configured separator and
key-value separator, to appendable. |
<A extends 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. |
StringBuilder |
appendTo(StringBuilder builder,
Iterable<? extends Map.Entry<?,? extends Collection<?>>> 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<?,? extends Collection<?>> map)
Appends the string representation of each entry of
map, using the previously configured separator and
key-value separator, to builder. |
StringBuilder |
appendTo(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. |
String |
join(Iterable<? extends Map.Entry<?,? extends Collection<?>>> entries)
Returns a string containing the string representation of each entry in
entries, using the previously
configured separator and key-value separator. |
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 CharSequence |
toString(Object part) |
MultimapJoiner |
useForNull(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 <A extends Appendable> A appendTo(A appendable, com.google.common.collect.Multimap<?,?> map) throws IOException
map, using the previously configured separator and
key-value separator, to appendable.IOExceptionpublic <A extends Appendable> A appendTo(A appendable, Map<?,? extends Collection<?>> map) throws IOException
map, using the previously configured separator and
key-value separator, to appendable.IOExceptionpublic StringBuilder appendTo(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 StringBuilder appendTo(StringBuilder builder, Map<?,? extends 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 String join(com.google.common.collect.Multimap<?,?> map)
map, using the previously
configured separator and key-value separator.public <A extends Appendable> A appendTo(A appendable, Iterable<? extends Map.Entry<?,? extends Collection<?>>> entries) throws IOException
entries, using the previously configured separator and
key-value separator, to appendable.IOExceptionpublic StringBuilder appendTo(StringBuilder builder, Iterable<? extends Map.Entry<?,? extends 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 String join(Iterable<? extends Map.Entry<?,? extends Collection<?>>> entries)
entries, using the previously
configured separator and key-value separator.protected CharSequence toString(Object part)
public MultimapJoiner skipNulls()
public MultimapJoiner useForNull(String nullText)
nullText for
any provided null keys or values.Copyright © 2015. All Rights Reserved.