Skip to content

Instantly share code, notes, and snippets.

@peysal
Last active December 21, 2015 13:49
Show Gist options
  • Save peysal/6315293 to your computer and use it in GitHub Desktop.
Save peysal/6315293 to your computer and use it in GitHub Desktop.
Groovy introduction: 1) list 2) operator overloading 3) method pointer
def list = []
assert list.isEmpty()
list.add("ayam")
list.add "babun" //optional parentheses, except if it doesnt have any argument
list << "cicak" //operator overloading
assert list.size == 3
println list
def tambah = list.&add //method pointer in action
tambah "dugong"
println list
assert list.size == 4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment