Execute diff in Java
I am looking for diff implementation in Java I see Python has its own sequencematcher (with difflib), which is exactly what I need... In Java
Is there a portage? Or are there any other classes / libraries that execute the same in Java?
If not, where can I find the source code of the difflib (such as freedom in speech) to enable me to implement sequencematcher in Java?
Unfortunately, Apache commons Lang didn't help me
thank you!
Solution
This library seems to be your future: Google diff match patch
It has the following main features:
>Difference: compares two plain text blocks and effectively returns a difference list. > Match: given a search string, find the best fuzzy match in a plain text block Accuracy and position of weighting. > Patch: applies the patch list to plain text Even if the underlying text does not match, use patches whenever possible
If you want an alternative, you can also try this: Java diff utils