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

org.clulab.wm.eidoscommon.utils.OptionUtils.scala Maven / Gradle / Ivy

The newest version!
package org.clulab.wm.eidoscommon.utils

import scala.language.reflectiveCalls

object OptionUtils {

  protected type IsEmptyAble = { def isEmpty: Boolean}

  def someOrNoneIfEmpty[C <: IsEmptyAble](collection: C): Option[C] = {
    if (collection.isEmpty) None
    else Some(collection)
  }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy