Skip to content

Instantly share code, notes, and snippets.

@l15k4
Last active February 20, 2017 20:18
Show Gist options
  • Save l15k4/c0fc99e8b4c51002b6c263885a67b809 to your computer and use it in GitHub Desktop.
Save l15k4/c0fc99e8b4c51002b6c263885a67b809 to your computer and use it in GitHub Desktop.
import com.twitter.chill._
object TwitterChillPlayGround extends App {
def serialize[T](t: T): Array[Byte] = ScalaKryoInstantiator.defaultPool.toBytesWithClass(t)
def deserialize[T](bytes: Array[Byte]): T = ScalaKryoInstantiator.defaultPool.fromBytes(bytes).asInstanceOf[T]
def roundTrip[T](t: T): T = deserialize(serialize(t))
require(Map("foo" -> "bar") == roundTrip(Map("foo" -> "bar")))
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment