Why Java Enumeration doesn't return properties list in order?

后端 未结 4 1082
情话喂你
情话喂你 2020-12-19 20:48

I\'m creating a simple program with the possibility to change the language and I would convert the list of properties in the file myBundle.properties in a String array.

4条回答
  •  孤城傲影
    2020-12-19 21:47

    I do not know the exact details of the ResourceBundle class, but when looking at your code example, it seems that it has key/value pairs.

    This suggests that it stores its content in an HashMap. (Again, as I do not know ResounrceBundle, this is a hunch) HashMap keys (and values) are unordered as they are stored on such a way that the value can be easily found for a given key.

提交回复
热议问题