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

commonMain.Optional.kt Maven / Gradle / Ivy

package io.fluidsonic.stdlib


data class Optional(
	val value: Value? = null
) {

	init {
		freeze()
	}


	inline fun  mapValue(mapping: (Value) -> MappedValue?) =
		Optional(value?.let(mapping))


	companion object {

		private val empty = Optional()


		@Suppress("UNCHECKED_CAST")
		fun  empty() = empty as Optional
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy