Pulling values from a Java Properties file in order?

前端 未结 15 759
庸人自扰
庸人自扰 2020-12-02 18:32

I have a properties file where the order of the values is important. I want to be able to iterate through the properties file and output the values based on the order of the

15条回答
  •  星月不相逢
    2020-12-02 19:01

    Nope - maps are inherently "unordered".

    You could possibly create your own subclass of Properties which overrode setProperty and possibly put, but it would probably get very implementation-specific... Properties is a prime example of bad encapsulation. When I last wrote an extended version (about 10 years ago!) it ended up being hideous and definitely sensitive to the implementation details of Properties.

提交回复
热议问题