Skip to content

Instantly share code, notes, and snippets.


Botaksy iBotasky

Block or report user

Report or block iBotasky

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
xiaofei-dev / BooleanExt
Created Nov 30, 2018
Boolean Extension, Say Goodbye to if-else expression
View BooleanExt
* Created by xiaofei on 2018/11/30.
* desc:Boolean Extension, Say Goodbye to if-else expression
sealed class BooleanExt<out T>//定义成协变
object Otherwise : BooleanExt<Nothing>()//Nothing是所有类型的子类型,协变的类继承关系和泛型参数类型继承关系一致
class TransferData<T>(val data: T) : BooleanExt<T>()//data只涉及到了只读的操作
You can’t perform that action at this time.