-2

i have this android code

HashMap<String,String> url_maps = new HashMap<String, String>();
        url_maps.put("Image 1", url0);
        url_maps.put("Image 2", url45);
        url_maps.put("Image 3", url90);
        url_maps.put("Image 4", url135);
        url_maps.put("Image 5", url180);
        url_maps.put("Image 6", url225);
        url_maps.put("Image 7", url270);

but why when it's show the order is not ascending, now the show is "3,4,1,2,7,6,5"

CommonsWare
  • 986,068
  • 189
  • 2,389
  • 2,491
Eggy Sudianto
  • 277
  • 3
  • 15

1 Answers1

2

Use LinkedHashMap to preserve insertion order.

Sujay
  • 3,417
  • 1
  • 23
  • 25