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);
 }
Esempio n. 2
0
 /**
  * Creates a new collector counting all elements
  *
  * @return util.data.ICollector
  */
 public static function counting()
 {
     return Aggregations::count();
 }