Is there a way to implement the following Java interface in Scala?
public interface Request {
void acceptLanguage(Locale... locales);
void acceptLanguage(String... locales);
}
I tried:
override def acceptLanguage(locales: Locale*) : Unit =
override def acceptLanguage(locales: String*) : Unit =
But that gives me:
error: double definition:
have same type after erasure
And I tried this:
override def acceptLanguage(locales: Locale*) (implicit Manifest[Locale]) : Unit = {}
override def acceptLanguage(locales: String*) (implicit Manifest[String]): Unit = {}
But that gives a different signature so override fails
I am using version 2.9.2.
Use @varargs
annotation:
override def acceptLanguage(@varargs locales: Locale*) : Unit =
override def acceptLanguage(@varargs locales: String*) : Unit =
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With