What is the Groovy 'it'?
问题 I have a collection which I process with removeIf {} in Groovy. Inside the block, I have access to some it identifier. What is this and where is it documented? 回答1: it is an implicit variable that is provided in closures. It's available when the closure doesn't have an explicitly declared parameter. When the closure is used with collection methods, such as removeIf , it will point to the current iteration item. It's like you declared this: List<Integer> integers = [1, 2, 3] for(Integer it: