Given following domain model:
case class Benefits(id: Int, benefitPlan: String, comment : String)
case class Employee(empNum : Int, benefits : List[Benefit])
I've been using Salat to help derialize/deserialize these objects. However, I'm a little confused as to how to delete/update a specific object from the benefits List in employee object given that I know the benefit.id of the object that is to be deleted/updated?
I do not want to iterate the full benefits list to be able to update a single object since this list may hold large number of objects at runtime. Is there a better way than getting the emp object, iterating the list until desired object is found, update it and then save the emp object back?