Here you can find the source of emptyToString(String str, String returnStr)
public static String emptyToString(String str, String returnStr)
//package com.java2s; /*/*from w ww.ja va 2 s .c o m*/ * Copyright (c) 2016 OpenDesign All rights reserved. * * This software is the confidential and proprietary information of OpenDesign. * You shall not disclose such Confidential Information and shall use it * only in accordance with the terms of the license agreement you entered into * with OpenDesign. */ public class Main { public static String emptyToString(String str, String returnStr) { return isNotEmpty(str) ? str : returnStr; } public static boolean isNotEmpty(String str) { return isNotNull(str) && !"".equals(str.trim()); } public static boolean isNotNull(String str) { return str != null; } public static boolean equals(String str1, String str2) { return isNotNull(str1) ? str1.equals(str2) : false; } public static String equals(String str1, String str2, String returnStr) { return equals(str1, str2) ? returnStr : ""; } }