kotlin双冒号

::method

函数名左边加上双冒号, 这个写法叫函数引用(Function Reference)

函数不是对象  但是在函数左边加双冒号 就是一个函数类型的对象了, 

这也是函数可以作为参数和返回值的原因。

基本上使用labmda表达式的地方 可以用函数引用的方式

   view?.post { 
           doSomething() 
        }
        
     // 用函数引用的写法
     view?.post(this::doSomething)
   private fun doSomething(){

    }

Remove redundant SAM-constructor

原文地址:https://www.cnblogs.com/huyang011/p/14273950.html