I searched a bit, but cannot find examples demonstrating the use of @_ * classes when matching classes with a pattern.
Below is an example of the application that I have in mind.
def findPerimeter(o: SomeObject): Perimeter = o match { case Type1(length, width) => new Perimeter(0, 0, length, width) case Type2(radius) => new Perimeter(0, 0, 2*radius, 2*radius) ... case MixedTypes(group @_*) => { \\How could @_* be used to check subpatterns of group? }
}
If someone can show me some examples or point me to a web page that has some examples that would be great.
thanks
operators scala pattern-matching
klactose
source share