def array = [1,2,3,4,5] println 3 in array
prints true . What do I need to overload to support in for any object?
Example:
class Whatever { def addItem(item) { // add the item } } def w = new Whatever() w.addItem("one") w.addItem("two") println "two" in w
I know that I could make a collection, that this class uses public, but I would like to use in .
operator-overloading language-features groovy
Geo
source share