Java 高级数据结构 —— Properties

1. Properties

Properties 是 Java 的内置实现:

public class Properties extends Hashtable<Object,Object> {}

其基本成员函数:

public synchronized Object setProperty(String key, String value) {
        return put(key, value);
    }

public String getProperty(String key) {
    Object oval = super.get(key);
    String sval = (oval instanceof String) ? (String)oval : null;
    return ((sval == null) && (defaults != null)) ? defaults.getProperty(key) : sval;
}

其实是对 HashTable 成员方法(put、get)的进一步封装。

原文地址:https://www.cnblogs.com/mtcnn/p/9421208.html