score:0
the method you are calling is probably a variadic function. in other words, it expects a variable number of arguments. these parameters are known as repeated parameters in scala, and are often referred to as varags. for example, you can call:
pmdmain(arg1, arg2, arg3)
notice how this is different from pmdmain(list(arg1, arg2, arg3))
– the former has multiple arguments of type string
, and the latter has a single argument of type list[string]
. the error you are hitting indicates that the first argument in the list is expected to be a string
, but you provided an array[string]
.
if you want to call the method with an instantiated list of arguments, you have to use the special sequence argument notation:
pmdmain(args: _*)
you can read more about repeated parameters and sequence arguments here in the spec.
if you want to play around with this in the repl, you can recreate the error quite simply:
def foo(args: string*) = ??? //the * indicates that args is variadic
foo("bar", "baz") //ok
foo(list("foo", "baz")) //bad
foo(list("foo", "baz"):_*) //ok
Source: stackoverflow.com
Related Query
- scala List .toArray failing for no apparent reason
- Reason for Scala list methods using mutables internally
- The "--" operator for list subtraction in Scala
- What is the Scala syntax for summing a List of objects?
- Scala groupBy for a list
- Scala List function for grouping consecutive identical elements
- Any reason for having "val capacity : Int" instead of "val Int Capacity" in Scala
- Scala polymorphic function for filtering an input List of Either
- Converting a Heterogeneous List to and from Json in Play for Scala
- How to parse json list or array in scala for play framework 2.2
- Scala 2.10 reflection: Why do I get the same type "List()" for the list and list element?
- scala maven plugin compile failing with the "version cannot be empty" for a random dependency
- Search scala list for something matching a property
- Filtering a Scala Either list for failures
- Scala for comprehension with Future, List and Option
- Scala - Why can't infer List of Seq for a list containing Vector and List?
- Scala Recursive For Comprehension Prepends Empty List Only Once, Why?
- Reason for type inference limitations in Scala compiler when dealing with partially applied functions
- syntax explanation for pattern matching a list in scala
- Fill List with values from a for loop in Scala
- Flattening List + Future for Scala
- Pattern Matching for List Of List in Scala
- A simple scala code for mapping a list to list elements order. (For generating line numbers)
- Scala List of tuple becomes empty after for loop
- asynchronous processing using list of Scala futures with onComplete for exception handling
- Play! failing to convert java list to scala list
- Scala reverse a map and new value is a list for duplicated key
- Define a 2d list and append lists to it in a for loop, scala
- creating an adjacency List for Graphs in Scala
- How to append elements to list in a for loop : Scala
More Query from same tag
- Why can't I embed implicit calls
- Why ++= is not working with the same list in Scala?
- How to consume api rest passing flink stream as parameter and return this stream transformed
- MaxSubArray using dynamic style
- How to separate business classes and auxiliary traits in Cake Pattern?
- Scala query type to Boolean type
- Pass angular data to scala route
- How do I override default codec in circe?
- Read a remote file from a specific node in my cluster using Spark Submit
- Spark scala error
- Scala - how to get and print the contents of Either?
- How to implicitly invoke a method when other methods are invoked?
- Using Scala to represent two JSON fields of which only one can be null
- All fields and parameters marked as non-null in Graphiql : Sangria, scala
- Where is the recursive call?
- scala implicit convertion and arrow
- Using a LDAP InMemoryDirectoryServer to authenticate User with Scala
- Converting String timestamp to Scala Timestamp with Timezone throws Unparseable exception
- Play Framework: How to Add a Header to Every Response
- Getting partition logs while running through Spark-Shell
- Overloaded Method Syntax in Scala
- PySpark: How to Update Nested Columns?
- Spark DataFrame Parallelism
- Does Spark's TwitterUtils library captures all the twitters?
- Extending traits that cover either one or all subtypes to handle one, some, or all subtypes
- Saving JSON in scala from SparkSQL
- Where to find tutorials for scaladoc 2?
- what does it mean by println(f(a))?
- Trouble implementing Perceptron in Scala
- Currying in hardware