How do I convert LinkedHashMap
to java.util.HashMap
in groovy?
When I create something like this in groovy, it automatically creates a LinkedHashMap
even when I declare it like HashMap h = ....
or def HashMap h = ...
I tried doing:
HashMap h = ["key1":["val1", "val2"], "key2":["val3"]]
and
def HashMap h = ["key1":["val1", "val2"], "key2":["val3"]]
h.getClass().getName()
still comes back with LinkedHashMap
.
LinkedHashMap
is a subclass of HashMap
so you can use it as a HashMap
.
Resources :
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