LinkedHashMap is used to preserve insertion order in the map, but this only works for mutable maps. Which is the immutable Map implementation that preserves insertion order?
LinkedHashMap is used to preserve insertion order in the map, but this only works
Share
ListMap implements an immutable map using a list-based data structure, and thus preserves insertion order.
The following extension method –
Seq#toListMapcan be quite useful when working withListMaps.