com.google.common.base
Class Joiner.MapJoiner

java.lang.Object
  extended by com.google.common.base.Joiner.MapJoiner
Enclosing class:
Joiner

public static final class Joiner.MapJoiner
extends java.lang.Object

An object that joins map entries in the same manner as 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:

Since:
2.0 (imported from Google Collections Library)

Method Summary
<A extends java.lang.Appendable,I extends java.lang.Object & java.lang.Iterable<? extends java.util.Map.Entry<?,?>> & java.util.Iterator<? extends java.util.Map.Entry<?,?>>>
A
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 java.lang.Appendable>
A
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>
A
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>
A
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.
<I extends java.lang.Object & java.lang.Iterable<? extends java.util.Map.Entry<?,?>> & java.util.Iterator<? extends java.util.Map.Entry<?,?>>>
java.lang.StringBuilder
appendTo(java.lang.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.
 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.
<I extends java.lang.Object & java.lang.Iterable<? extends java.util.Map.Entry<?,?>> & java.util.Iterator<? extends java.util.Map.Entry<?,?>>>
java.lang.String
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.
 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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

appendTo

public <A extends java.lang.Appendable> A appendTo(A appendable,
                                                   java.util.Map<?,?> map)
                                        throws java.io.IOException
Appends the string representation of each entry of map, using the previously configured separator and key-value separator, to appendable.

Throws:
java.io.IOException

appendTo

public 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. Identical to appendTo(Appendable, Map), except that it does not throw IOException.


join

public 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.


appendTo

@Beta
@Deprecated
public <A extends java.lang.Appendable,I extends java.lang.Object & java.lang.Iterable<? extends java.util.Map.Entry<?,?>> & java.util.Iterator<? extends java.util.Map.Entry<?,?>>> A appendTo(A appendable,
                                                                                                                                                                                                              I entries)
                                        throws java.io.IOException
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.

Deprecated.

Throws:
java.io.IOException
Since:
11.0

appendTo

@Beta
public <A extends java.lang.Appendable> A appendTo(A appendable,
                                                        java.lang.Iterable<? extends java.util.Map.Entry<?,?>> entries)
                                        throws java.io.IOException
Appends the string representation of each entry in entries, using the previously configured separator and key-value separator, to appendable.

Throws:
java.io.IOException
Since:
10.0

appendTo

@Beta
public <A extends java.lang.Appendable> A appendTo(A appendable,
                                                        java.util.Iterator<? extends java.util.Map.Entry<?,?>> parts)
                                        throws java.io.IOException
Appends the string representation of each entry in entries, using the previously configured separator and key-value separator, to appendable.

Throws:
java.io.IOException
Since:
11.0

appendTo

@Beta
@Deprecated
public <I extends java.lang.Object & java.lang.Iterable<? extends java.util.Map.Entry<?,?>> & java.util.Iterator<? extends java.util.Map.Entry<?,?>>> java.lang.StringBuilder appendTo(java.lang.StringBuilder builder,
                                                                                                                                                                                                     I entries)
                                 throws java.io.IOException
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.

Deprecated.

Throws:
java.io.IOException
Since:
11.0

appendTo

@Beta
public 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. Identical to appendTo(Appendable, Iterable), except that it does not throw IOException.

Since:
10.0

appendTo

@Beta
public 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. Identical to appendTo(Appendable, Iterable), except that it does not throw IOException.

Since:
11.0

join

@Beta
@Deprecated
public <I extends java.lang.Object & java.lang.Iterable<? extends java.util.Map.Entry<?,?>> & java.util.Iterator<? extends java.util.Map.Entry<?,?>>> java.lang.String join(I entries)
                      throws java.io.IOException
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.

Deprecated.

Throws:
java.io.IOException
Since:
11.0

join

@Beta
public 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.

Since:
10.0

join

@Beta
public 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.

Since:
11.0

useForNull

@CheckReturnValue
public 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.