Who has encountered a null pointer exception?
Behind the scenes in Java, all variables are pointers. What are the implications of this for when we are designing and writing code?
Problem:
Suppose you have a container class (list, dictionary, set, etc.) that contains Items
. An obvious method you would want is getItem
.
What are the ways you might handle a getItem(item)
called when the requested item is not in the container?
empty_node
class from CS223 binary search tree lab.Null Objects have methods that implement “nothing” in just the right way.
In this context: “nothing” => “inconsequential”
The Null Object Pattern is an elegant solution to help eliminate the need null pointer checks.