logo
  • 教程列表
  • SO官方文檔
  • 關閉
    • 閉包含隱式引數
    • 用顯式引數關閉
    • 使用隱式接收器關閉具有自定義目標的方法呼叫
    • 用方法包裝閉包周圍的行為
    • 建立分配給屬性和呼叫的閉包
    • 將方法轉換為閉包
  1. StackOverflow 文件
  2. groovy 教程
  3. 關閉
  4. 閉包含隱式引數

閉包含隱式引數

Created: November-22, 2018

['cat', 'dog', 'fish'].collect { it.length() }

如果你有一個引數並且未明確命名引數,則 it 是引數的預設名稱。你也可以選擇宣告引數。

['cat', 'dog', 'fish'].collect { animal -> animal.length() }
  • 用顯式引數關閉
  • 關閉

Copyright © 2018. All right reserved

tastones.com 备案号:鲁ICP备18045372号-1

  • 關於本站
  • 免責聲明