After reading the documentation for LinkedHashMap
(and having used it several times), I'm still not clear about one of its properties...is the iteration order for a LinkedHashMap
:
entrySet()
, keySet()
, and values()
, orentrySet()
and keySet()
but not values()
, orentrySet()
?I imagine the third scenario to be unlikely, but I would like to know if anyone knows if (1) or (2) is true since iteration over values()
is probably a rare use case.
LinkedHashMap
respects insertion order; so the first choice is the good.
A Map
being a set of Map.Entry
objects, options 2 and 3 would be rather strange ;)
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