From 54e9c4829720a09e732f0ec998dd316836d0b69d Mon Sep 17 00:00:00 2001 From: Tony Rankin Date: Tue, 6 Sep 2016 14:39:22 -0700 Subject: [PATCH] Converting type of default value for float/double map getters --- .../java/org/wordpress/android/util/MapUtils.java | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/WordPressUtils/src/main/java/org/wordpress/android/util/MapUtils.java b/WordPressUtils/src/main/java/org/wordpress/android/util/MapUtils.java index fecba47dc2b3..c6e72dc5b7c2 100644 --- a/WordPressUtils/src/main/java/org/wordpress/android/util/MapUtils.java +++ b/WordPressUtils/src/main/java/org/wordpress/android/util/MapUtils.java @@ -47,10 +47,13 @@ public static long getMapLong(final Map map, final String key, long defaul } } + /* + * float version of above + */ public static float getMapFloat(final Map map, final String key) { return getMapFloat(map, key, 0); } - public static float getMapFloat(final Map map, final String key, long defaultValue) { + public static float getMapFloat(final Map map, final String key, float defaultValue) { try { return Float.parseFloat(getMapStr(map, key)); } catch (NumberFormatException e) { @@ -58,10 +61,13 @@ public static float getMapFloat(final Map map, final String key, long defa } } + /* + * double version of above + */ public static double getMapDouble(final Map map, final String key) { return getMapDouble(map, key, 0); } - public static double getMapDouble(final Map map, final String key, long defaultValue) { + public static double getMapDouble(final Map map, final String key, double defaultValue) { try { return Double.parseDouble(getMapStr(map, key)); } catch (NumberFormatException e) { @@ -74,7 +80,7 @@ public static double getMapDouble(final Map map, final String key, long de * returns null if key doesn't exist or isn't a date */ public static Date getMapDate(final Map map, final String key) { - if (map==null || key==null || !map.containsKey(key)) + if (map == null || key == null || !map.containsKey(key)) return null; try { return (Date) map.get(key);