fork download
  1. /* package whatever; // don't place package name! */
  2.  
  3. import java.util.*;
  4. import java.lang.*;
  5. import java.io.*;
  6.  
  7. /* Name of the class has to be "Main" only if the class is public. */
  8. class Ideone
  9. {
  10. public static void main(String[] args) {
  11. //map principal
  12. Map<Integer, HashMap<String, String>> codeStateList = new HashMap<>();
  13. //cria um map para cruzar estado cidade
  14. HashMap<String, String> stateCity = new HashMap<>();
  15. //adiciona o par estado cidade
  16. stateCity.put("Sao paulo", "Osasco");
  17. //salva no map principal o code cruzando com map com par estado-cidade
  18. codeStateList.put(1253, stateCity);
  19. //para exibir ou pegar o par
  20. System.out.println(codeStateList.get(1253));
  21. }
  22. }
Success #stdin #stdout 0.1s 320576KB
stdin
Standard input is empty
stdout
{Sao paulo=Osasco}