Google Collections ImmutableMap iteration order

I need combination of Google Collection ImmutableMap and LinkedHashMap — immutable map with defined iteration order. It seems that ImmutableMap itself actually has defined iteration order, at least its documentation says:

An immutable, hash-based Map with reliable user-specified iteration order.

However there are no more details. Quick test shows that this might be true, but I want to make sure.

My question is: can I rely on iteration order of ImmutableMap? If I do ImmutableMap.copyOf(linkedHashMap), will it have same iteration order as original linked hash map? What about immutable maps created by builder? Some link to authoritative answer would help, since Google didn't find anything useful. (And no, links to the sources don't count).

25
задан double-beep 2 February 2019 в 14:44
поделиться