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

后端 未结 4 1080
情话喂你
情话喂你 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条回答
  •  旧时难觅i
    2020-12-19 21:44

    Se if replacing

    Enumeration keys = labels.getKeys();
    

    with

    List keys =  Collections.list( labels.getKeys() );
    Collections.sort(keys);
    

    helps

提交回复
热议问题