implemented double using map.