Shortest way to reverse Properties

后端 未结 3 1484
一生所求
一生所求 2021-01-22 09:05

In Java I have a java.util.Properties object and I want to obtain another one with the same pairs but keys converted to values and viceversa.

If there are c

3条回答
  •  挽巷
    挽巷 (楼主)
    2021-01-22 10:02

    You can consider using a BiMap by google collections which is essentially a reversable Map. It guarantees uniquness of keys as well as values.

    Check it out here. This is the API

提交回复
热议问题