Is there a Java library that can “diff” two Objects?

前端 未结 7 1034
长发绾君心
长发绾君心 2020-11-28 03:35

Is there a Java utility library that is analogous to the Unix program diff, but for Objects? I\'m looking for something that can compare two objects of the same type and ge

相关标签:
7条回答
  • 2020-11-28 04:17

    You could also take a look at the solution from Apache. Most projects already have it on their classpath since its part of commons-lang.

    Check difference for specific field(s):
    http://commons.apache.org/proper/commons-lang/javadocs/api-3.9/org/apache/commons/lang3/builder/DiffBuilder.html

    Check difference by using reflection:
    http://commons.apache.org/proper/commons-lang/javadocs/api-3.9/org/apache/commons/lang3/builder/ReflectionDiffBuilder.html

    0 讨论(0)
提交回复
热议问题