Created
July 31, 2015 08:24
-
-
Save edwardbeckett/a683f526017f66793a7d to your computer and use it in GitHub Desktop.
Sample isNull for @DAC_dev
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 )); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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...