org.clulab.wm.eidoscommon.utils.OptionUtils.scala Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of eidos-eidoscommon_2.12 Show documentation
Show all versions of eidos-eidoscommon_2.12 Show documentation
Code to be shared by other Eidos subprojects and clients
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