Groovy is complaining about unexpected token: ->

Viewed 3641

I've got the following Groovy script in Mule.

import org.custommonkey.xmlunit.XMLUnit.*
def expected = 
    getClass().getResourceAsStream('/samples/in/request.xml').text 

XMLUnit.setIgnoreWhitespace(true)
def documentDiff = DiffBuilder
            .compare(expected)
            .withTest(message.getInboundProperty('webServiceRequest'))
            .withNodeFilter(node -> !node.getNodeName().equals('EffectiveDate'))
            .build()

For some reason Groovy is complaining about "->"..

Script3.groovy: 10: unexpected token: -> @ line 10, column 34.
               .withNodeFilter(node -> !node.getNodeName().equals(EffectiveDate))

I don't get it. I thought that was fine in Groovy? Am i missing something?

2 Answers
Related