Here you can find the source of emptyToNull(String str)
public static String emptyToNull(String str)
//package com.java2s; //License from project: Open Source License public class Main { public static String emptyToNull(String str) { return isEmpty(str) ? null : str; }// w w w.j a va 2 s .c om public static boolean isEmpty(String str) { return (str == null || "".equals(str.trim())); } public static boolean equals(String str1, String str2) { if (str1 != null && str1 != null) { return str1.equals(str2); } else if (str1 == null && str2 == null) { return true; } else { return false; } } }