So.. is there any other solution ?
# announcements
j
So.. is there any other solution ?
p
What do you want to achieve? Can you describe for those who does not know Scala?
r
vote for the following issue: https://youtrack.jetbrains.com/issue/KT-209 Kotlin does not support lower bounds yet
👍 1
p
And there is a solution in a comment to this issue. Use extension function:
Copy code
fun <B, A : B> Test<A>.test(): B
j
@Pavlo Liapota I want to implement the class like with Scala’s Option. And I’m confused to implement to getOrElse function. It takes a type
[B >: A]
which means the type B is supertype of A. How can I implement this code to kotlin???
Copy code
sealed abstract class Option[+A] extends Product with Serializable {
  self =>

    ... 
  @inline final def getOrElse[B >: A](default: => B): B =
    if (isEmpty) default else this.get
    ...
p
Also check arrow library. There should be a class that you are looking for.
👍 1
j
Thx!