A Hashmap contains a key with a value that can be an Integer or Double.
This works if the value is of type Double but fails for type Integer:
Double value = (Double) locationMap.get("key");
Unfortunately I cannot seem to control the type, as it is JSON data transmitted from a server. Apparently, even if the number is of type double server-side (Javascript) before transmission, but does not have decimal digits, it will be interpreted as Integer somewhere along the line on the client side (Java).
What is the shortest way to account for a possible Integer value and cast it to Double?