title: Collections.sort() is not getting called/executed i.e not entering this method only
body: <p>I am making use of Collections.sort() method to sort a list of records based on time field.But my program execution is not entering this method only. 
  I am getting a list of treatment object records from my database which I'm storing in <strong>list</strong> variable.
  I'm filtering these records based on some parameters and I'm storing the filtered in a list <strong>dosages</strong> which is of DosagaData type.
  After this I need to sort the filtered list based on <strong>time</strong> field for which I made use of Collections.sort() which is not getting called.</p>
  
  <p>'''</p>
  
  <pre><code>private List&lt;TreatmentObject&gt; list;
  private List&lt;DosageData&gt; dosages;
  
  for (int i = 0; i &lt; list.size(); i++) {
  DosageData dosage = new DosageData(list.get(i));
  System.out.println("Dosage data is" +  dosage);
  if(dosage != null) {
     dosages = new ArrayList&lt;DosageData&gt;();
     dosage.dosageTime = time;
     System.out.println("DosageData time is " + dosage.dosageTime);
     this.dosages.add(dosage);
     this.dosageCount += 1;
    }
  }
  
  Iterator&lt;DosageData&gt; dosaegDataIterator = dosages.iterator();
  
  while (dosaegDataIterator.hasNext()) {
    System.out.println("Before Sorting " + dosaegDataIterator.next().dosageTime);
  }
  
  Collections.sort(dosages, new Comparator&lt;DosageData&gt;() {
  @Override
  public int compare(DosageData first, DosageData second) {
  System.out.println("Inside Dosage Sorter Class");
  Date firstDate = null, secondDate = null;
  String firstTimes = first.dosageTime;
  System.out.println("First time is" + firstTimes);
  SimpleDateFormat sdf = new SimpleDateFormat("HH:mm:ss.SSSZZZZZ");
  try {
     firstDate = sdf.parse(firstTimes);
     System.out.println("First date is" + firstDate);
  } catch (ParseException e) {
     e.printStackTrace();
  }
     String secondTimes = second.dosageTime;
     System.out.println("Second time is" + secondTimes);
  try {
     secondDate = sdf.parse(secondTimes);
     System.out.println("Second date is" + secondDate);
  } catch (ParseException e) {
     e.printStackTrace();
  }
  System.out.println("Return result is" + firstDate.compareTo(secondDate));
  return firstDate.compareTo(secondDate);
  }
  });
  
  for (DosageData dosage : dosages) {
     System.out.println("After Sorting" + dosage.dosageTime);
  }
  
  System.out.println("Sorted Dosages is" +dosages);
  </code></pre>