mikebaum / RxUI

A toolkit for reactive (event/stream) based UI development on the JVM
Apache License 2.0
0 stars 0 forks source link

Add Merge Operator #19

Closed mikebaum closed 8 years ago

mikebaum commented 8 years ago

This issue tracks the work to add a merge operator for Properties.

mikebaum commented 8 years ago

Merge operator added as per PR #23.

mikebaum commented 8 years ago

Re-opening this issue to remove the merge operator, since a merge operator does not make sense for Properties. A merge operation is only really meaningful for event streams, since properties always have a current value.

Consider the following:

Property<String> propertyA = Property.create("a");
PropertyObservable<String> observable = propertyA.map(val -> val + "b");

PropertyObservable<String> merged = propertyA.mergeWith(observable);

propertyA.setValue("b")

the output would be:

a
ab
b
bb

however, if the order was replaced as:

...
PropertyObservable<String> merged = observable.mergeWith(propertyA);
...

the result would be:

ab
a
bb
b

So the value of the merge depends on the order of the passed PropertyObservables.

mikebaum commented 8 years ago

Removed merge in PR #25.