Is it possible to stack loaded properties in Java? For instance can I do:
Properties properties = new Properties();
properties.load(new FileInputStream(\"file1.
Yes the properties stack. Properties
extends Hashtable
and load()
simply calls put()
on each key-value pair.
Relevant code from the Source:
String key = loadConvert(lr.lineBuf, 0, keyLen, convtBuf);
String value = loadConvert(lr.lineBuf, valueStart, limit - valueStart, convtBuf);
put(key, value);
In other words, loading from a file doesn't clear the current entries. However, note that if the two files contain entries with the same key, the first one will be overwritten.