Hello. When I print the values and keys of Map
, it comes from the bottom up. I wanted to know how I can get it from top to bottom.
import java.util.HashMap;
import java.util.Map;
import java.util.Map.Entry;
public class ClassDebug {
public static void main(String a[]){
Map<String, Integer> map = new HashMap<String, Integer>();
map.put("Alemanha", 7);
map.put("Brasil ", 1);
for(Entry<String, Integer> entry: map.entrySet()) {
System.out.println(entry.getKey());
}
// Imprime: Brasil
// Imprime: Alemanha
// Eu quero que imprima:
// Alemanha e Brasil :V
}
}