plus
Merges two DataObject objects together.
Keys from the right-hand-side (rhs) of this operator will be preferred over the left-hand-side (lhs). In all cases, key clashes will simply take the value from the right-hand-side.
e.g.
val lhs = DataObject.create {
put("string", "value")
put("int", 1)
put("object", DataObject.create {
put("key1", "string")
put("key2", true)
})
}
val rhs = DataObject.create {
put("string", "new value")
put("object", DataObject.create {
put("key1", "new string")
put("key3", "extra string")
})
}
val merged = lhs + rhs
// merged will be the equivalent of this:
DataObject.create {
put("string", "new value") // from rhs
put("int", 1) // from lhs
put("object", DataObject.create {
put("key1", "new string") // from rhs
put("key3", "extra string") // from rhs
})
}Content copied to clipboard
Return
A new DataObject that contains the merged key-value pairs from both DataObjects
Parameters
other
The incoming values to merge into this DataObject