tl  tr
  Home | Tutorials | Articles | Videos | Products | Tools | Search
Open Source | Tag Cloud | Follow Us | Bookmark | Contact   
 
 Tools and Libs > Google Guava > Basic > Is Null or Empty

Is Null or Empty 

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 Strings.isNullOrEmpty() API. It returns TRUE if the given string is null or empty.

File Name  :  
com/bethecoder/tutorials/guava/base_tests/StringNullEmptyTest.java 
Author  :  Sudhakar KV
Email  :  kvenkatasudhakar@gmail.com
   
package com.bethecoder.tutorials.guava.base_tests;

import com.google.common.base.Strings;


public class StringNullEmptyTest {

  /**
   @param args
   */
  public static void main(String[] args) {
    System.out.println(Strings.isNullOrEmpty("BTC"));
    System.out.println(Strings.isNullOrEmpty("           "));

    System.out.println(Strings.isNullOrEmpty(""));
    System.out.println(Strings.isNullOrEmpty(null));
  }
}
   

It gives the following output,
false
false

true
true


                    Print

   



Books Recommendation

 
 
bl  br