I have the following issue.
I have some data stored in memory (coming from a database query) by using a hash table:
Map<String,MyObject>
where MyObject consists of 3 arrays: float[], int[] and double[]. I use Float.MIN_VALUE, Integer.MIN_VALUE and Double.MIN_VALUE to store values having a NULL value in the database.
I need to process the input hash table and store the output in a hash table
Map<String, Double> output
which must contain only NON NULL values.
So, I perform a comparison like this:
Double value = ... (get a value from MyObject)
if(value != Float.MIN_VALUE && value != Double.MIN_VALUE && value != Integer.MIN_VALUE){
// add to OUTPUT hash table
but the if statement doesn't work properly when value equals to Float.MIN_VALUE: the first component always returns TRUE (meaning the two values are different).
I also tried something like that
if(value != new Double(Float.MIN_VALUE))
but the problem is still there.
Anyone could suggest me a solution to properly compare the values?
EDIT: Is it safe to use something like that:
String.valueOf(value).equals(String.valueOf(Float.MIN_VALUE))) ?
It seems to work.