When using java.util.Map.of()
, it does not preserve ordering. Is there a way to have immutable Map
which does preserve ordering?
I believe what you are looking for is LinkedHashMap. Linked Hashmap is a like a regular HashMap that preserves insertion order.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With