lundi 24 février 2020

Diff Two Strings Line-By-Line in Java using Diff-Match-Patch

I was looking for an easy way to do a Myers Diff on two Strings line-by-line in Java.

According to this, the Google diff-match-patch library has this feature. But, in the Java version, those methods referenced are protected and/or package-protected!

I couldn't find another library that (1) does this, and (2) appears to be well-maintained.

So I ended up using reflection to get the Google one to let me do this. I want to avoid anyone having to re-implement it, so I will post what I did as an answer.





Aucun commentaire:

Enregistrer un commentaire