Avoiding Billion Dollar Mistake in your code
Different challenges arises from been an influential computer scientist. One of the old greatest computer scientist who invented “null” “Tony Hoare” said , one of my billion dollar mistake is the invention of null, he made the mistake without seeing the billion dollars.
No doubt , null is use to represent the absence of a value which blows up the code in the nearest future with the dreaded NullPointerException. Using null can thus be replaced with Optional function , using Optional means
1. You are documenting the values that are meant to be absent in class API
2. Checking whether a variable is null in order to avoid possible bugs
String message = null; message = "Avoid billion dollar mistake in your code" Optional<String> optionalMessage = Optional.of(message)
Using optional means you are checking if the value is null or not.
I hope this help… (: