Skip to content

Instantly share code, notes, and snippets.

@bbarker
Created December 12, 2021 04:41
Show Gist options
  • Save bbarker/687e8780487be738d2c17723f1ffe444 to your computer and use it in GitHub Desktop.
Save bbarker/687e8780487be738d2c17723f1ffe444 to your computer and use it in GitHub Desktop.
create a new class and a few example values
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