我正在学习Kotlin。我的代码如下:overridefunonViewCreated(view:View?,savedInstanceState:Bundle?){super.onViewCreated(view,savedInstanceState)decoupler.attachNotifier(this)if(activityisScreenRouter){decoupler.attachRouter(activity)}}attachRouter()方法:funattachRouter(router:ScreenRouter?){this.router=router}如doc
我正在学习Kotlin。我的代码如下:overridefunonViewCreated(view:View?,savedInstanceState:Bundle?){super.onViewCreated(view,savedInstanceState)decoupler.attachNotifier(this)if(activityisScreenRouter){decoupler.attachRouter(activity)}}attachRouter()方法:funattachRouter(router:ScreenRouter?){this.router=router}如doc
我正在尝试编写代码并想为第10天创建一个类。我知道这些值可以为null,因此我将它们声明为可为null。在某些时候,我需要检查该值是否已分配并对其进行处理。问题来了。我事先通过high!=null进行检查,但在接下来的行中,我必须使用!!让编译器相信它实际上是null。它似乎找不到合适的compareTo方法,尽管首先对其进行了空检查。我猜,它没有智能转换我的变量privateclassBot(valnumber:Int,varlow:Int?,varhigh:Int?){funacceptValue(value:Int){if(low==null&&high==null){high=