何时使用Properties和Java中的Map? [英] When to use Properties and when Map in Java?

查看:224
本文介绍了何时使用Properties和Java中的Map?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Map和Properties之间的区别,因为它们都具有键值对。

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

推荐答案

地图用于正常键值代码中的对使用。属性通常用于存储和加载文件中的配置值。 Properties的底层实现使用Map。

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

这篇关于何时使用Properties和Java中的Map?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆