Google Guava Joiner Example

Google Guava Joiner Example

import java.util.Arrays;

import com.google.common.base.Joiner;

public class JoinerTest {

public static void main(String[] args) {

System.out.println(“Joiner Use With String”);

System.out.println(Joiner.on(“:”).join(“java”,”proficiency”));

System.out.println(“Joiner Use With  List”);

System.out.println(Joiner.on(“+”).join(Arrays.asList(10,20,30)));

}

}

Output:

Joiner Use With String

java:proficiency

Joiner Use With  List

10+20+30

Leave a Reply

Your email address will not be published. Required fields are marked *

58 − = 57