getOrDefault

fun getOrDefault(defaultValue: @UnsafeVariance T): T

Returns the success value if this is a Success, or the defaultValue if this is a Failure.

val data: ByteArray = result.getOrDefault(byteArrayOf())

Return

The success value or the default value.

Parameters

defaultValue

The value to return if this is a failure.