+ Start a Discussion
Arunkumar RArunkumar R 

Iteration Order for Maps and Sets Is Now Predictable (Summer 15 Release Update)

Hi Guys,
  1. Until the Spring 15 release, Maps and Sets are Unordered Collections. So the returned order will be random.
  2. But beginning from Summer 15 release onwards, Maps and Set order is predictable. The order will be same that what you put from the beginning to end.
Example:
Map<String, String> orderedMap = new Map<String, String>();
orderedMap.put('Good', 'This is so good');
orderedMap.put('Bad', 'This is so bad');
System.debug(orderedMap);

If you run the above code snippet in Developer console you will get the returned order as below,

Until Spring 15 Release:

{Bad=This is so bad, Good=This is so good}

From Summer 15 Release:

{Good=This is so good, Bad=This is so bad}

This changes is not the API level, this is Schema level change. If anyone relying on the Map or Set order in your codes, change it as soon. 

Thanks.
Best Answer chosen by Arunkumar R
Arunkumar RArunkumar R
Thank you all. Hope this information is helpful..!

All Answers

Andy BoettcherAndy Boettcher
Thanks Arunkumar!
Monika Bhardwaj 4Monika Bhardwaj 4
Thanks ArunKumar... can try after 3 days :)
doravmondoravmon
Great !!!! Thanks Arunkumar !~~
Jitendra RawatJitendra Rawat
Great !!! Thank you :)
Emre TuncbilekEmre Tuncbilek
Good to know, thank you!
Beer NutthawanBeer Nutthawan
Thanks a lot!!!
rushiErushiE
Thanks  Arunkumar
Apoorv Saxena 4Apoorv Saxena 4
Good to know that Arunkumar...Thank You!!
anand k 11anand k 11
Thanks Arunkumar
Akhil AnilAkhil Anil
Thanks Arun
Arunkumar RArunkumar R
Thank you all. Hope this information is helpful..!
This was selected as the best answer
Chidanand MChidanand M
@Rahul,

Bro... it is still at aschema level.

It is not at in the API Level
WEN JIEWEN JIE
Greate
harsha__charsha__c
That's cool :) Kudos

Thanks Arun for sharing...

- Harsha