Sorry for the long delay, but maybe some explanation is still helpful for you or others:
The *-parameters are not supposed to be regular expressions or something like this but simply a way to allow methods (or in our case case classes) to take an arbitrary number of arguments (the keyword if you wanna Google that is varargs
). Maybe the test cases are also helpful to see how you can use *-parameters.
This also means that instead of
Code: Alles auswählen
you can simply write
as no parameters are also a possible option.
If you ever need to convert an actual List[X] into a "list" of parameters for a function expecting X*-arguments, you can simply write
to perform the necessary conversion.
Also, you can do the opposite to convert *-arguments into a list in pattern matching by writing
We already have some comments and the conversion shown above in the template for the task, so for your work you can simply assume that args
is a regular list.
Oh and about your posted code: Your code fragment probably doesn't work because your pattern matching doesn't do the @ _*
part, which means that it specifically requires the matched method to have exactly one parameter (while WrappedArray() is equivalent to no parameters).