Skip to content

Instantly share code, notes, and snippets.

@edwardbeckett
Created July 31, 2015 08:24
Show Gist options
  • Save edwardbeckett/a683f526017f66793a7d to your computer and use it in GitHub Desktop.
Save edwardbeckett/a683f526017f66793a7d to your computer and use it in GitHub Desktop.
Sample isNull for @DAC_dev
import static java.util.Objects.*;
/**
* @author Edward Beckett :: <[email protected]>
* @since :: 7/31/2015
*/
public class IsNullTest {
private static Object one; // implicitly null
/**
* Syntactic Sugar for null obj definition.
*
* @param obj
* @return
*/
public static Object defineObj( Object obj ) {
return isNull( obj ) ? new Object() : obj;
}
public static void main( String[] args ) {
// Should be true as it was declared but never defined.
System.out.println( "Is Null? : " + isNull( one ));
// define Object reference [one]
one = defineObj( one );
// Should return 'false' as it is now defined.
System.out.println( "Is Null? : " + isNull( one ));
}
}
@edwardbeckett
Copy link
Author

Gotchya... then CF's implementation isn't checking for object references which, kinda defeats the point of having 'isNull' at all, isNull should be checking for 'Object references' imho...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment