Reputation: 7228
I want to declare a method explicitly with a return type as in :
def method() : Int = {}
But I want to return a Map((String,Int))
instead. So far I couldnT make it work.
Is this an invalid method signature in scala? if so why?
def parseEmptySpaceLine0 (array: Array[String]): Map(String, Int) = {
//stuff
Map("", 1)
}
Upvotes: 0
Views: 161
Reputation: 68640
Generic type parameter should be enclosed in []
, not in ()
. Much like the Array[String]
in your signature.
So it's Map[String, Int]
you're looking for.
Upvotes: 6