scala-generics Questions
1
Solved
So this is a fairly direct port of this Java question to scala
We have a bunch of traits that take generic parameters as follows:
trait Ident { }
trait Container[I <: Ident] {
def foo(id: ...
Omdurman asked 9/11, 2016 at 15:59
2
Solved
I tried writing a function with a generic return type but it doesn't work unless I cast the return type. Please see the function getSomething() below I expected it to work without the casting. What...
Eboat asked 5/11, 2016 at 17:53
2
Solved
Lets say I have an array like this*:
val foo: Any = 1 : Int
Option(foo.asInstanceOf[String])
which fails for obvious reason:
// java.lang.ClassCastException: java.lang.Integer cannot be cast to...
Pelota asked 21/3, 2016 at 18:6
1
© 2022 - 2024 — McMap. All rights reserved.