Tags: maxifridge/mapstruct
Tags
Use retainAll() for Set and Map instead of clear() This limits side effects of removing preemptively all elements through clear() to non-Set Collections and Arrays. A good example of why it is important is : when mapping to a Set property of a Hibernate-managed entity, calling clear() then addAll() effectively triggers requests for all deletions then all additions ; though because of the order of execution in Hiberante, only new elements are inserted.