Skip to content

Instantly share code, notes, and snippets.

View justwrote's full-sized avatar
👋
Working from home

justwrote

👋
Working from home
View GitHub Profile
@justwrote
justwrote / gist:5070815
Created March 2, 2013 12:34
For all those who cannot remember what filter/filterNot does (including myself) ...
import scala.collection._
object BetterFilterMethods {
// Scala 2.10
implicit class BetterFilter[+A, +Repr](val trav: GenTraversableLike[A, Repr]) extends AnyVal {
def filterInclude(pred: A => Boolean): Repr = trav filter pred
def filterExclude(pred: A => Boolean): Repr = trav filterNot pred
}