/** * Deserializes the map data from a string. * * @param s The string representation of the map data. */ public void deserialize(String s) { // Reset the map unmapAll(); // Parse the new map data from the multi-delimited string if (s != null) { // Read the input mappings String[] pairs = s.split(","); for (String pair : pairs) { String[] elements = pair.split(":"); if (elements.length == 2) { try { int value = Integer.parseInt(elements[0]); int key = Integer.parseInt(elements[1]); mMap.put(key, value); } catch (NumberFormatException ignored) { } } } } }