Created
July 15, 2020 22:52
-
-
Save parzibyte/f48851d2df3582fb8a87686b6a696aa5 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static String asciiAMorse(String ascii) { | |
Hashtable<String, String> equivalencias = obtenerEquivalencias(); | |
return equivalencias.getOrDefault(ascii, ""); | |
} | |
public static String morseAAscii(String morseBuscado) { | |
Hashtable<String, String> equivalencias = obtenerEquivalencias(); | |
Set<String> claves = equivalencias.keySet(); | |
// La clave es la letra ASCII | |
for (String clave : claves) { | |
String morse = equivalencias.get(clave); | |
if (morse.equals(morseBuscado)) { | |
return clave; | |
} | |
} | |
return ""; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment