{class JoinerTest public public static void main (String args []) { //. 1, the set of strings list, in the form of a string into List <String> the ArrayList list = new new <String> (); List.add ( "XX"); List.add ( "ZZ"); List.add ( "dd"); //Joiner.on ( ",") to obtain the object instance Joiner Joiner Joiner = Joiner.on ( ","); / /joiner.join(list) incoming set of operations, and to turn into a string format System.out.println (joiner.join (List)); // output: XX, ZZ, dd // 2, the Iterator < T> list into a string Iterator <string> = list.iterator (); string str = Joiner.on ( "|") the Join (IT);. System.out.println (str); // output: XX | ZZ | dd //. 3, a plurality of strings connected . String str1 = Joiner.on ( ", ") join ( " small", "father", "mother", "grandfather", "grandmother"); System.out.println (str1); // output: small small, father, mother, grandfather, grandmother // 4, the connection string list StringBuilder builder = new StringBuilder ( "little cleverest"); // return type StringBuilder StringBuilder str2 = Joiner.on ( "," ) appendTo. (Builder, List); System.out.println (str2); // output: little behaved XX, ZZ, dd //. 5, a null value is skipped connector List.add (null); List.add ( "small small "); // skipNulls () on behalf of removing null String str3 = Joiner.on (", ") skipNulls () the Join (List);.. System.out.println (str3); // output: xx, zz, dd,小小 Little @ 6, replacing null value connector String str4=Joiner.on(",").useForNull("空").join(list); System.out.println (str4); // Output: xx, zz, dd, empty, little // 7 , Map value pairs print the Map <String, String> = new new Map the HashMap <> (); map.put ( "key1", "VALUE1"); map.put ( "key2", "value2"); Map .put ( "key3", "value3"); . Joiner.MapJoiner mapJoiner = Joiner.on ( ",") withKeyValueSeparator ( "="); System.out.println (mapJoiner.join (Map)); // output : = VALUE1 key1, key2 = value2, value3 = key3 //. 8, step the string to List <Long> set (first front Switch list <string>, with the back of the characteristic java8 List <string> Switch List < Long>) List<Long> list=Splitter.on("#").splitToList("111#222#333").stream().mapToLong(str->Long.parseLong(str)).boxed().distinct().collect(Collectors.toList()); } }