tl  tr
  Home | Tutorials | Articles | Videos | Products | Tools | Search
Interviews | Open Source | Tag Cloud | Follow Us | Bookmark | Contact   
 Tools and Libs > Google Guava > Basic > Joiner Skip Nulls

Joiner Skip Nulls 

Google Guava is a java library with lot of utilities and reusable components. This requires the library guava-10.0.jar to be in classpath. The following example shows using Joiner class. It joins the given strings with provided separator.

File Name  :  
Author  :  Sudhakar KV
Email  :  [email protected]
package com.bethecoder.tutorials.guava.base_tests;


public class JoinSkipNullValuesTest {

   @param args
  public static void main(String[] args) {
    Joiner joiner = Joiner.on(":").skipNulls()//Skip all null values
    String str = joiner.join("One", null, null, "Two""Three", null, "Four")


It gives the following output,


bl  br