Showing posts with label guava joiner example. Show all posts
Showing posts with label guava joiner example. Show all posts

Thursday, 14 May 2015

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