Class MultimapJoiner


  • public class MultimapJoiner
    extends java.lang.Object
    An object that joins multimaps in the same manner as 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 Summary

      Constructors 
      Constructor Description
      MultimapJoiner​(com.google.common.base.Joiner entryJoiner, java.lang.String separator, java.lang.String keyValueSeparator)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      <A extends java.lang.Appendable>
      A
      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.
      <A extends java.lang.Appendable>
      A
      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>
      A
      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.
      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.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.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.
      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.
      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.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • MultimapJoiner

        public MultimapJoiner​(com.google.common.base.Joiner entryJoiner,
                              java.lang.String separator,
                              java.lang.String keyValueSeparator)
    • Method Detail

      • appendTo

        public <A extends java.lang.Appendable> A appendTo​(A appendable,
                                                           com.google.common.collect.Multimap<?,​?> 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 <A extends java.lang.Appendable> A appendTo​(A appendable,
                                                           java.util.Map<?,​? extends java.util.Collection<?>> 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,
                                                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. Identical to appendTo(Appendable, Multimap), except that it does not throw IOException.
      • appendTo

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

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

        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
        Appends the string representation of each entry in entries, 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.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. Identical to appendTo(Appendable, Iterable), except that it does not throw IOException.
      • join

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

        protected java.lang.CharSequence toString​(java.lang.Object part)
      • useForNull

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