Created
December 12, 2021 04:41
-
-
Save bbarker/687e8780487be738d2c17723f1ffe444 to your computer and use it in GitHub Desktop.
create a new class and a few example values
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
case class ScalaBean[A](initA: A): | |
private var theA: A = initA | |
def getTheA: A = theA | |
def setTheA(a: A): Unit = { | |
this.theA = a | |
} | |
val bean1: ScalaBean[Int] = ScalaBean(1) | |
val bean2: ScalaBean[String] = ScalaBean("Foo") | |
val bean3: ScalaBean[Int] = ScalaBean(2) | |
// val beanList1: List[ScalaBean[Any]] = List(bean1, bean2, bean3) | |
val beanList2: List[ScalaBean[?]] = List(bean1, bean2, bean3) | |
val beanList3: List[ScalaBean[Int]] = List(bean1, bean3) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment