什么是“引擎盖下”的差异?有什么实际差异?
与用户的观点有什么不同吗?
我知道您可以使用1) def list = ["a", "b", "c", "d"]
list.findAll({println(it)})
2) def list = ["a", "b", "c", "d"]
list.collect({println(it)})
3) def list = ["a", "b", "c", "d"]
list.grep({println(it)})
来定义方法,但是您可以定义一条消息吗?
答案 0 :(得分:2)
When you send a message to an object, the object will (usually) respond by executing a method with the same name as that message.
You cannot define messages. You just send them.