When to use Properties and when Map in Java?

前端 未结 9 680
抹茶落季
抹茶落季 2020-12-16 15:29

Difference between Map and Properties as both have key-value pair.

9条回答
  •  孤街浪徒
    2020-12-16 15:49

    A map is meant for normal key-value pair usage in code. Properties are typically used for storing and loading configuration values from a file. The underlying implementation of a Properties uses a Map.

    See the link below for a quick tutorial on how and when to use Properties.

    http://docs.oracle.com/javase/tutorial/essential/environment/properties.html

提交回复
热议问题