I have two class:
class Item(val description: String, val id: String)
class ItemList {
private var items : ListBuffer[Item] = ListBuffer()
}
How can I check if items contain one item with description=x and id=y?
I have two class:
class Item(val description: String, val id: String)
class ItemList {
private var items : ListBuffer[Item] = ListBuffer()
}
How can I check if items contain one item with description=x and id=y?
That would be
If you also implement
equalsfor your class (or even better, make it acase classwhich does that automatically), you can simplify that to