I have the following code
Map<Integer, Double> map = new HashMap<Integer, Double>();
Double number = map.get(0); //suppose this equals 1
double number2 = objectThatReturnsPrimitiveDouble.getQuantity();//suppose this equals 2
System.out.print(number < number2); //spits out true
I am wondering if comparing the values of number
and number2
is good practice even though one is a primitive type and the other is a Class type. Or will it be acceptable to change the primitive type of number2
to Double
?