Hi!
I want to ensure that if a Double or Integer is null, it is converted to 0.0 and 0, thus preventing nullpointer.
I'm thinking about a generic method that takes a Number, and checks if it is Double or Integer with instanceof.
Then it checks for null and if it is, it returns new Double(0.0) or new Integer(0). The method would have a return type Number in this case.
I wonder if such method already exists somewhere in
java or apache commons. So far i could not find anything like this.
Thanks