Class Joiner.MapJoiner

  • Enclosing class:
    Joiner

    public static final class Joiner.MapJoiner
    extends 
    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:

    • To output a separate entry for each key-value pair, pass multimap.entries() to a MapJoiner method that accepts entries as input, and receive output of the form key1=A&key1=B&key2=C.
    • To output a single entry for each key, pass multimap.asMap() to a MapJoiner method that accepts a map as input, and receive output of the form key1=[A, B]&key2=C.
    Since:
    2.0
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      <A extends >
      A
      appendTo​(A appendable, <? extends <?,​?>> entries)
      Appends the string representation of each entry in entries, using the previously configured separator and key-value separator, to appendable.
      <A extends >
      A
      appendTo​(A appendable, <? extends <?,​?>> parts)
      Appends the string representation of each entry in entries, using the previously configured separator and key-value separator, to appendable.
      <A extends >
      A
      appendTo​(A appendable, <?,​?> map)
      Appends the string representation of each entry of map, using the previously configured separator and key-value separator, to appendable.
       builder, <? extends <?,​?>> entries)
      Appends the string representation of each entry in entries, using the previously configured separator and key-value separator, to builder.
       builder, <? extends <?,​?>> entries)
      Appends the string representation of each entry in entries, using the previously configured separator and key-value separator, to builder.
       builder, <?,​?> map)
      Appends the string representation of each entry of map, using the previously configured separator and key-value separator, to builder.
      <? extends <?,​?>> entries)
      Returns a string containing the string representation of each entry in entries, using the previously configured separator and key-value separator.
      <? extends <?,​?>> entries)
      Returns a string containing the string representation of each entry in entries, using the previously configured separator and key-value separator.
      <?,​?> map)
      Returns a string containing the string representation of each entry of map, using the previously configured separator and key-value separator.
      Joiner.MapJoiner  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.

        , , , , , , , , , ,
    • Method Detail

      • appendTo

        public <A extends > A appendTo​(A appendable,
                                                 <?,​?> map)
                                          throws 
        Appends the string representation of each entry of map, using the previously configured separator and key-value separator, to appendable.
        Throws:
      • appendTo

        public   builder,
                                      <?,​?> map)
        Appends the string representation of each entry of map, using the previously configured separator and key-value separator, to builder. Identical to .
      • appendTo

        @Beta
        
        public <A extends > A appendTo​(A appendable,
                                                 <? extends <?,​?>> entries)
                                          throws 
        Appends the string representation of each entry in entries, using the previously configured separator and key-value separator, to appendable.
        Throws:
        Since:
        10.0
      • appendTo

        @Beta
        
        public <A extends > A appendTo​(A appendable,
                                                 <? extends <?,​?>> parts)
                                          throws 
        Appends the string representation of each entry in entries, using the previously configured separator and key-value separator, to appendable.
        Throws:
        Since:
        11.0
      • appendTo

        @Beta
        
        public   builder,
                                      <? extends <?,​?>> entries)
        Appends the string representation of each entry in entries, using the previously configured separator and key-value separator, to builder. Identical to .
        Since:
        10.0
      • appendTo

        @Beta
        
        public   builder,
                                      <? extends <?,​?>> entries)
        Appends the string representation of each entry in entries, using the previously configured separator and key-value separator, to builder. Identical to .
        Since:
        11.0
      • join

        public  <?,​?> map)
        Returns a string containing the string representation of each entry of map, using the previously configured separator and key-value separator.
      • join

        @Beta
        public  <? extends <?,​?>> 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  <? extends <?,​?>> 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

        public  nullText)
        Returns a map joiner with the same behavior as this one, except automatically substituting nullText for any provided null keys or values.