bigwheel / util-backports

A backport library of scala.util in Standard Library from Scala 2.13 to 2.12

Version Matrix

util backports from scala 2.13 to 2.12 and 2.11Build Status

This is a backport library of Scala Standard Library scala.util package from 2.13 to 2.12 and 2.11.

2.13 scala.util package contains following new features.

  • tap
  • pipe
  • Using (loan pattern)


util-backports is available from maven central.

If you use SBT you can include util-backports in your project with

libraryDependencies += "com.github.bigwheel" %% "util-backports" % "2.1"


import scala.util.chaining._

val str = "42"
println(1 + str.pipe(_.length))

import scala.util.Using

Using.resource(new PrintWriter("write-target.txt")) { pw =>
  pw.write("hello world")
  // no need to close !

Hint for util-backports developers

How to check util package new feature in 2.13

git clone
cd scala
git diff --stat=300,300 --stat-graph-width=20 origin/2.12.x..origin/2.13.x -- src/library/scala/util
git diff --stat=300,300 --stat-graph-width=20 origin/2.12.x..origin/2.13.x -- test/junit/scala/util