All Downloads are FREE. Search and download functionalities are using the official Maven repository.

cgta.oscala.extensions.BooleanExtensions.scala Maven / Gradle / Ivy

The newest version!
package cgta.oscala
package extensions


//////////////////////////////////////////////////////////////
// Copyright (c) 2014 Ben Jackman, Jeff Gomberg
// All Rights Reserved
// please contact [email protected] or [email protected]
// for licensing inquiries
// Created by bjackman @ 8/11/14 3:27 AM
//////////////////////////////////////////////////////////////

class BooleanExtensions(val b: Boolean) extends AnyVal {
  @inline def ifElse[A](t: => A, f: => A): A = if (b) t else f
  @inline def trueToSome[A](t: => A): Option[A] = if (b) Some(t) else None
  @inline def falseToSome[A](f: => A): Option[A] = if (!b) Some(f) else None

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy