I have two files with a size of very 50,000 lines. I need to compare these two files and identify the changes. However, the catch in the event that the string is present in a different position, it can not be displayed as different.
For example, consider this A.txt file
xxxxx
yyyyy
zzzzz
B.txt File
zzzzz
xxxx
yyyyy
So, if this is the contents of the file. My code should give the result as xxxx (or both xxxx and xxxxx).
Of course, the easiest way is to save each line of the file to
List< String>
and comparing with another
List< String>.
But it seems to take a lot of time. I also tried using DiffUtils in java. But it does not recognize lines present in different line numbers, as such. So is there any other algorithm that could help me?