Skip to content

Instantly share code, notes, and snippets.

@gkhays
Created August 6, 2013 20:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gkhays/6168489 to your computer and use it in GitHub Desktop.
Save gkhays/6168489 to your computer and use it in GitHub Desktop.
Quick and dirty C# style isNullOrEmpty helper for Java.
package org.test;
public class Utils
{
private Utils() {}
/**
* Determines whether or not the given string is null or contains an empty
* value.
* @param s
* @return true if the given string is null or empty; otherwise returns false
*/
public static boolean isNullOrEmpty(String s)
{
if (s == null) return true;
return s.isEmpty();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment