def checkExpressions = { obj, otherObj -> def resultA = Optional.ofNullable(obj).orElse(otherObj) def resultB = obj ?: otherObj println "Para $obj -> A: $resultA | B: $resultB" } def checkExpressionsWithOther = checkExpressions.rcurry('other') [ null, true, false ].each { checkExpressionsWithOther(it) }