title: Java ArrayList Sort on the basis of dynamic objects fields?
body: <p>I am getting a issue i have below code </p>
  
  <pre><code>public void columnsList(List&lt;TableRecord&gt; records){
  
      for(TableRecord record : records){
          Table table = record.getTable();
          //Do sort here on stampDate
          Field[] fields = table.fields();
          for(Field field : fields){
              field.getName();
              record.getValue(field);
  
          }
      }
  
  }
  </code></pre>
  
  <p>and <code>records</code> object contain Object of different class type </p>
  
  <pre><code>List&lt;TableRecord&gt; records = new List&lt;TableRecord&gt;();
  records.add(new AddressRecord());
  records.add(new CityRecord());
  records.add(new UserRecord());
  </code></pre>
  
  <p>Now how i need to sort them by <code>stampDate</code> variable which is in each class how can we do it when we have different classes in list</p>