The Min operator operates on an Observable that emits numbers (or items that can be evaluated as numbers), and emits a single item: the item with the smallest number.
TBD
TBD
In RxGroovy, this operator is not in the ReactiveX core, but is part of the distinct
rxjava-math module.
RxGroovy implements a min operator. It takes an optional comparator that it
will use instead of its default to compare the value of two items. If more than one item
has the identical minimum value, min will emit the last such item
emitted by the source Observable.
The minBy operator is similar to min, but instead of emitting the
item with the minimum value, it emits the item with the minimum key, where that
key is generated based on a function you provide to minBy
In RxJava, this operator is not in the ReactiveX core, but is part of the distinct
rxjava-math module.
RxJava implements a min operator. It takes an optional comparator that it
will use instead of its default to compare the value of two items. If more than one item
has the identical minimum value, min will emit the last such item
emitted by the source Observable.
The minBy operator is similar to min, but instead of emitting the
item with the minimum value, it emits the item with the minimum key, where that
key is generated based on a function you provide to minBy
RxJS implements the min operator. It takes an optional comparer function that it
will use instead of its default to compare the value of two items.
var source = Rx.Observable.fromArray([1,3,5,7,9,2,4,6,8]).min();
var subscription = source.subscribe(
function (x) { console.log('Next: ' + x); },
function (err) { console.log('Error: ' + err); },
function () { console.log('Completed'); } );Next: 1 Completed
The minBy operator is similar to min, but instead of emitting the
item with the minimum value, it emits the item with the minimum key, where that
key is generated based on a function you provide to minBy. minBy
also takes an optional second parameter: a comparer function that it will use instead of its
default to compare the keys of the two items.
minBy emits a list. If more than one item has the minimum key value, each such
item will be represented in the list.
var source = Rx.Observable.fromArray([1,3,5,7,9,2,4,6,8,1])
.minBy( function (x) { return x; } );
var subscription = source.subscribe(
function (x) { console.log('Next: ' + x); },
function (err) { console.log('Error: ' + err); },
function () { console.log('Completed'); } );Next: 1,1 Completed
min and minBy are found in the following distributions:
rx.all.jsrx.all.compat.jsrx.aggregates.jsThey requires one of the following:
rx.jsrx.compat.jsrx.lite.jsrx.lite.compat.jsTBD
RxPHP implements this operator as min.
Returns the minimum value in an observable sequence according to the specified comparer.
//from https://github.com/ReactiveX/RxPHP/blob/master/demo/min/min.php
/* Without comparer */
$source = \Rx\Observable::fromArray([1, 3, 5, 7, 9, 2, 4, 6, 8])
->min();
$subscription = $source->subscribe($createStdoutObserver());
Next value: 1
Complete!
//from https://github.com/ReactiveX/RxPHP/blob/master/demo/min/min-with-comparer.php
/* With a comparer */
$comparer = function ($x, $y) {
if ($x > $y) {
return 1;
} elseif ($x < $y) {
return -1;
}
return 0;
};
$source = \Rx\Observable::fromArray([1, 3, 5, 7, 9, 2, 4, 6, 8])
->min($comparer);
$subscription = $source->subscribe($createStdoutObserver());
Next value: 1
Complete!
TBD
TBD
TBD