Github user jacek-lewandowski commented on the pull request:
https://github.com/apache/spark/pull/4220#issuecomment-72272628
Look at this simple example:
```scala
val parent = new Properties()
parent.setProperty("test1", "A")
val child = new Properties(parent)
child.put("test2", "B")
val copy = new Properties()
copy.putAll(child)
child.getProperty("test1")
child.getProperty("test2")
copy.getProperty("test1")
copy.getProperty("test2")
```
which will result in:
```
scala> res3: String = A
scala> res4: String = B
scala> res5: String = null
scala> res6: String = B
```
In other words: `new Properties(oldProperties)` initialises a new
properties by setting oldProperties as a parent (defaults). On the other hand
`new Properties().putAll(oldProperties)` copies only those properties which
were explicitly set and cuts the whole hierarchy with defaults. Only cloning
gives you the same object.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]