title: How to compare two objects in arraylist and make it as one object
body: <p>I have a array list </p>
  
  <pre><code>`List&lt;Employee&gt; list = new ArrayList&lt;Employee&gt;()
  Employee emp1 = new Employee()
  emp1.setEmpNumber("1234");
  emp1.setDueAmount("11");
  emp1.setAge(20)
  Employee emp2 = new Employee()
  emp2.setEmpNumber("1234");
  emp2.setDueAmount("14");
  emp2.setAge(20)
  Employee emp3 = new Employee()
  emp3.setEmpNumber("567");
  emp3.setDue("11");
  emp3.setAge(20)
  Employee emp4 = new Employee()
  emp4.setEmpNumber("891");
  emp4.setDueAmount("11");
  emp4.setAge(20)
  Employee emp5 = new Employee()
  emp5.setEmpNumber("1234");
  emp5.setDueAmount("14");
  emp5.setAge(20)`
  </code></pre>
  
  <p>In the List there are three employee with the same Number but the due amount is different.
  How to compare employee number by retrieving the list and add the due amount and make that object as single object?</p>