Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

#3695 Use retainAll() for Set and Map instead of clear()#3696

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Draft
maxifridge wants to merge1 commit intomapstruct:main
base:main
Choose a base branch
Loading
frommaxifridge:#3695-retainAll

Conversation

maxifridge
Copy link

@maxifridgemaxifridge commentedSep 4, 2024
edited
Loading

Implementation of#3695
Using retainAll() for Set and Map targets will minimize the amount of add/remove operations required for these types.
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 (and the one that made me work on this issue) : 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 Hibernate, only the newer elements are inserted, the others are deleted.

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.
@maxifridgemaxifridge marked this pull request as draftSeptember 4, 2024 09:38
@maxifridgemaxifridge changed the titleUse retainAll() for Set and Map instead of clear()#3695 Use retainAll() for Set and Map instead of clear()Sep 4, 2024
@maxifridge
Copy link
Author

This is still only a draft, it requires some cleaning/renaming, and certainly updating tests.

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers
No reviews
Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

2 participants
@maxifridge@mfrigot-klee

[8]ページ先頭

©2009-2025 Movatter.jp