Originally posted by Garrett Rowe:
Does the Groovy syntax of:
multiply => *
extend to other symbols:
divide => /
subtract => -
add => +
etc...
Are there any non-math related symbols that can be defined by this convention?
[ September 25, 2008: Message edited by: Garrett Rowe ]
Yes. Take a look at the
Groovy JDK for List.
The subscript operator []:
myList[0] <====> myList.getAt(0)
myList[1..2] <====> myList.getAt(1..2)
myList[0] = 2 <====> myList.putAt(0, 2)
etc... (there are many more overloaded putAt() methods)
Leftshift <<:
myList << 4 <====> myList.leftShift(4)
Minus -:
myList - 3 <=====> myList.minus(3)
This is just an one example.
Here is the
full list of operators supported by Groovy and the methods they map go:
[ September 26, 2008: Message edited by: Matthew Taylor ]