Why Kotlin list removeAll doesnt not work in this example:

Why Kotlin list removeAll doesnt not work in this example:

orderList.addAll(allProducts)
orderList.removeAll(allProducts)

The code above will add the products but not remove them.
orderList is a mutableList. allProducts is a list of Products

Product:

class Product : EmbeddedRealmObject {
var name: String = ""
var category: String = ""
var productDescription: String? = ""
var price: Float = 0F
var imagine: String? = null
}

Issue Solved. I had to implement equals() function on my object

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.