-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
  • 954,112
  • 185
  • 2,315
  • 2,367
Eggy Sudianto
  • 277
  • 3
  • 15

1 Answers1

2

Use LinkedHashMap to preserve insertion order.

sJy
  • 3,357
  • 1
  • 22
  • 25