lambada表达式 配置 123456789 defaultConfig { jackOptions { enabled true } }compileOptions { targetCompatibility 1.8 sourceCompatibility 1.8 } 123456789101112131415161718192021222324252627 interface { //要执行的闭包函数声明 public int backGound(int a);}//实现闭包函数的方法/** lab:闭包的声明的实例*/void implementLam(showLab lab) { int a = 2; //可以对闭包回调 返回值 操作 int b = lab.backGound(a);}//实现lambada函数implementLam((a)->{ //闭包返回值 return 1;}) 赞微海报分享
近期评论