Hi,
I have a sorted list that contains several maps, each of those maps have a key and a value. The key of each map is a number. I want to convert this list to a map of maps but if I do that, maps get automatically ordered by a key (“1”, “2”, “3”…) and I want to keep values sorted like they are in the list. So I thought about changing the keys to “1”, “2”, “3” etc while keeping the values sorted like in the example but I can’t find a way to do it. Can someone help me here?
Current List
[
%{"2" => %{"id" => "c"}},
%{"4" => %{"id" => "e"}},
%{"0" => %{"id" => "a"}},
%{"3" => %{"id" => "d"}},
%{"1" => %{"id" => "b"}}
]
Wanted List or Map
[
%{"0" => %{"id" => "c"}},
%{"1" => %{"id" => "e"}},
%{"2" => %{"id" => "a"}},
%{"3" => %{"id" => "d"}},
%{"4" => %{"id" => "b"}}
]