This method is intended to replace the use of the putAll
method of Properties
inherited from java.util.Hashtable
.
The problem with that method is that, since it is inherited from
Hashtable
, default properties are lost.
For example, the following code
Properties a;
Properties b;
//initialize ...
a.putAll(b);
will fail
if b
had been constructed with a default
Properties
object. Those defaults would be lost and
not added to
a
.
The above code could be correctly performed with this method,
like this:
Properties a;
Properties b;
//initialize ...
PropertiesUtils.putAll(a,b);
In the above example,
a
is modified - properties are added to
it (note that if
a
has defaults they will remain unaffected.)
The properties from
b
,
including defaults, will be
added to
a
using its
setProperty
method -
these new properties will overwrite any pre-existing ones of the same
name.