← 返回首页
Added ability to apply patch to existing list inplace by andre161292 · Pull Request #152 · java-diff-utils/java-diff-utils · GitHub
Skip to content

Navigation Menu

Toggle navigation
Sign in
Appearance settings
Search or jump to...

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

Provide feedback

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

Include my email address so I can be contacted

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
Resetting focus

Added ability to apply patch to existing list inplace#152

Merged
wumpz merged 3 commits into
java-diff-utils:masterfrom
andre161292:feature/apply-to-original-collection
Sep 1, 2022
Merged

Added ability to apply patch to existing list inplace#152
wumpz merged 3 commits into
java-diff-utils:masterfrom
andre161292:feature/apply-to-original-collection

Conversation

andre161292 commented Jul 28, 2022
edited
Loading

Copy link
Copy Markdown
Contributor

Motivation

I'm using java-diff-utils to update lists in JPA models from a DTOs. As Hibernate uses proxies and records any removal/add/swap, but has it's problems when using clear/addAll, this is the only option to make patching my lists work.

In older versions i accessed AbstractDelta's applyTo directly, but that fell away when it was made hidden in 3075742.

Changes

I added a the methods applyToExisting and it's opposite restoreToExisting to Patch, to make it possible to update lists in-place and updated JavaDoc accordingly.

Minor improvements

I corrected a typo in the method-name verifyAntApplyTo -> verifyAndApplyTo

wumpz commented Aug 16, 2022

Copy link
Copy Markdown
Collaborator

But as I understand it, you did not add but change the existing behaviour, right?

Copy link
Copy Markdown
Contributor Author

But as I understand it, you did not add but change the existing behaviour, right?

No, i didn't change the existing behavior. I extracted the core functionality to make it accessible from the outside, that's why it looks changed at first.

wumpz merged commit 7d0fd54 into java-diff-utils:master Sep 1, 2022
andre161292 deleted the feature/apply-to-original-collection branch September 1, 2022 21:25
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

Footer

© 2026 GitHub, Inc.