Folks,
duvida tem como a chave sair em ordem crescente …
abs
public static void main (String[] args){
int max = 5;
Integer codigo=0;
LinkedHashMap m = new LinkedHashMap();
m.put("98", "B98");
m.put("100", "P");
m.put("101", "P1");
m.put("1", "A1");
m.put("2", "B1");
m.put("3", "C1");
m.put("99", "B100");
m.put("98", "B101");
m.put("98", "B980");
//
Iterator inovo = m.keySet().iterator();
while(inovo.hasNext()){
String chave = (String)inovo.next();
System.out.println("chave="+chave);
String conteudo= (String) m.get(chave) ;
System.out.println(" conteudo="+conteudo);
System.out.println("--------------------------------");
}
resultado:
chave=98
conteudo=B980
--------------------------------
chave=100
conteudo=P
--------------------------------
chave=101
conteudo=P1
--------------------------------
chave=1
conteudo=A1
--------------------------------
chave=2
conteudo=B1
--------------------------------
chave=3
conteudo=C1
--------------------------------
chave=99
conteudo=B100
--------------------------------