title: Show the differences of the 2 java objects using the Audit Trial
body: <p>Hi I have implemented java code for finding the difference of 2 java objects using the comparator interface with the help of few folks here. Now i want to implement the code which has to log(Audit Trial) all the differences between 2 objects. My code is here,      </p>
  
  <pre><code>public class A implements Comparator&lt;A&gt; {
      private int id1, id2; 
      /* setters and getters for id1 and id2 */                 
  
      public int compare(A o1, A o2) {
          if (o1 == o2) {
              return 0;
          } else if (o1 == null) {
              return -1;
          } else if (o2 == null) {
              return 1;
          }
          if (o1.getId1() != o2.getId1()) {
              return o1.getId1() - o2.getId1();
          } else {
              return o1.getId2() - o2.getId2();
          }
      }   
      public static void main(String args[]) {
  
          A obj1 = new A();
          obj1.id1 = 10;
          obj1.id2 = 20;
  
          A obj2 = new A();
          obj2.id1 = 10;
          obj2.id2 = 30;
  
          if (obj1.compare(obj1, obj2) == 0) {
              System.out.println("EQUALS");
          } else {
              System.out.println("NOT EQUALS");
          }
         }
  
   Please advise me how i can implement the code for AuditTrial here. Thanks.
  </code></pre>