DZone Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

Michael has posted 1 posts at DZone. View Full User Profile

Inlines Objects In Scala

09.11.2009
| 1551 views |
  • submit to reddit
        // I wish the following worked, so I could write something like
// myWrapper.items(2).checked = true

class Wrapper(base:SomeOtherClass){
  object items{
    def apply(position:Int) = object {
      def checked_=(isChecked:Boolean){
        base.setItemChecked(position,isChecked)
      }
    }
  }
}