Introduction

Michael Mirwaldt

Introduction

Motivation

All objects are direct or indirect subclasses of the super class "Object". It defines an "equals"-method. This method compares the callee object with a parameter object. If they are regarded as equal, then it returns true, else false. This check can be sufficient for a programmer. However, the return value does not say anything about the differences. It only says that at least one difference was detected at all.
Whenever programmers want to know more, they have to examine the objects on their own. Then they write those individually for every object again and again. They wished objects to have a "diff(...)"-method that delivers information about differences. They might call it after "equals()" if they are optimistic or instead of "equals()" if they are pessimistic.
Optimistic and pessimistic refers their expectation of differences here. An optimistic programmer might expect two objects to be equal. A pessimistic tester might assume differences in opposite.

Objectives

JDiffUtils compares two items and finds the differences if they exist.

Items can be

  • collections
  • strings
  • bits
  • arrays
  • objects
  • types
  • (swing) models
  • folders
  • xml-files
  • json-strings

JDiffUtils is

  • lightweight
  • simple to use
  • fast
  • very useful

References

Explanation of "equals()":
http://docs.oracle.com/javase/tutorial/java/IandI/objectclass.html
Reference implementation of "equals()":
http://javahowto.blogspot.de/2007/01/override-equals-and-hashcode-methods.html


Related

Wiki: Home