Skip to content

Commit

Permalink
Change name of filter to filterBefore
Browse files Browse the repository at this point in the history
  • Loading branch information
johnynek committed Feb 17, 2015
1 parent b5b0296 commit b9e5f7b
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,7 @@ trait MonoidAggregator[-A, B, +C] extends Aggregator[A, B, C] { self =>
/**
* Only aggregate items that match a predicate
*/
def filter[A1 <: A](pred: A1 => Boolean): MonoidAggregator[A1, B, C] =
def filterBefore[A1 <: A](pred: A1 => Boolean): MonoidAggregator[A1, B, C] =
new MonoidAggregator[A1, B, C] {
def prepare(a: A1) = if (pred(a)) self.prepare(a) else self.monoid.zero
def monoid = self.monoid
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ class AggregatorLaws extends PropSpec with PropertyChecks with Matchers {
}
property("MonoidAggregator.filter is correct") {
forAll { (in: List[Int], ag: MonoidAggregator[Int, Int, Int], fn: Int => Boolean) =>
assert(ag.filter(fn).apply(in) == ag.apply(in.filter(fn)))
assert(ag.filterBefore(fn).apply(in) == ag.apply(in.filter(fn)))
}
}
}

0 comments on commit b9e5f7b

Please sign in to comment.