Skip to content

Instantly share code, notes, and snippets.

Last active December 17, 2015 03:19
What would you like to do?
Does away with this pesky compiler warning in scala 2.10.0 "`withFilter' method does not yet exist on org.json4s.JValue, using `filter' method instead"
import org.json4s.JValue
implicit class LiftJValueWithFilter(self: JValue)
extends JValueWithFilter(self, _ => true)
class JValueWithFilter(self: JValue, p: JValue => Boolean) {
def map(f: JValue => T): List[T] =
def flatMap(f: JValue => List[T]): List[T] =
def foreach(f: JValue => Unit): Unit =
def withFilter(q: JValue => Boolean): JValueWithFilter =
new JValueWithFilter(self, x => p(x) && q(x))
Copy link

Thanks a lot! Obvious, but so useful!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment