Ejemplo n.º 1
0
 public function min_max_sum_average_and_count_for_non_empty()
 {
     Sequence::of([1, 2, 3, 4])->collecting($min, Aggregations::min())->collecting($max, Aggregations::max())->collecting($average, Aggregations::average())->collecting($sum, Aggregations::sum())->collecting($count, Aggregations::count())->each();
     $this->assertEquals(1, $min);
     $this->assertEquals(4, $max);
     $this->assertEquals(2.5, $average);
     $this->assertEquals(10, $sum);
     $this->assertEquals(4, $count);
 }
Ejemplo n.º 2
0
 /**
  * Returns the smallest element.
  *
  * @param  var $comparator default NULL Either a Comparator or a closure to compare.
  * @return var
  * @throws lang.IllegalArgumentException if streamed and invoked more than once
  */
 public function min($comparator = null)
 {
     return $this->collect(Aggregations::min($comparator));
 }