Class EmptyRef

java.lang.Object
pro.tyshchenko.nullhater.EmptyRef

public final class EmptyRef extends Object
Author:
Alexander Tyshchenko
  • Constructor Details

    • EmptyRef

      public EmptyRef()
  • Method Details

    • justEmpty

      public static <T> T justEmpty()
      Some situation
      
       Object value = null; // here in as Object can be any class
        // you always need to assign with null reference
        // of course you can use Optional.ofNullable(), but exist situations
        // when you need to use just reference and you truly OOP guy that hate
        // null reference in code
       if (some condition) {
           value = ... some value
       } else if (some condition) {
           value = ... some value
       }
      
      Usage
      
       Object value = justEmpty();
       
      Type Parameters:
      T -
      Returns:
      wrapped null reference