title: How to convert ExpressionList of specific type to generic
body: <p>I am trying to create a method which will be return a Generic Expression List.</p>
  
  <p>In between based on some condition i am creating ExpressionList of specific type and at the end i want to convert that ExpressionList to generic ExpressionList. But, unfortunately i have stuck in conversion.</p>
  
  <p>Below is the code snipet.</p>
  
  <p>I am trying to create a method which will be return a Generic Expression List.</p>
  
  <p>In between based on some condition i am creating ExpressionList of specific type and at the end i want to convert that ExpressionList to generic ExpressionList. But, unfortunately i have stuck in conversion.</p>
  
  <p>Below is the code snipet.</p>
  
  <pre><code>  public static &lt;T&gt; ExpressionList&lt;T&gt; generateTransactionList(Map&lt;String,String[]&gt; params, Party party){
  
      String filter = "";
  
      Date startDate = new Date(params.get("startDate")[0]);
      Date endDate = new Date(params.get("endDate")[0]+" 23:59:59");
      //endDate.setDate(endDate.getDate() + 1);
  
      ExpressionList&lt;TypeOne&gt; TypeOneExpressionList = null;
      ExpressionList&lt;TypeTwo&gt; TypeTwoResponseExpressionList = null;
      if(settleState == 3) {
          TypeTwoResponseExpressionList = TypeTwo.find.select("*").where()
                  .between("response_date", startDate, endDate)
                  .eq("status", "failed");
      }
      else {
                  acquiringTransactionExpressionList = AcquiringTransaction.find.select("*").where()
                      .between("transactionTime", startDate, endDate)
                      .ne("acquiringTransactionStatusType.id", 99);
  
              }
  
      ExpressionList&lt;T&gt; returningTypeOneExpressionList = null;
      Class&lt;T&gt; convert = null;
      if(TypeOneExpressionList != null) {
          TypeOneExpressionList.orderBy("id desc"  );
          Iterator&lt;TypeOne&gt; iterator = TypeOneExpressionList.findIterate();
          while(iterator.hasNext()) {
              returningTypeOneExpressionList.add((Expression) convert.cast(iterator.next()));
          }
      }
      else {
          TypeTwoResponseExpressionList.orderBy("id desc"  );
          Iterator&lt;TypeTwo&gt; iterator = TypeTwoResponseExpressionList.findIterate();
          while(iterator.hasNext()) {
              returningTypeOneExpressionList.add((Expression) convert.cast(iterator.next()));
          }
      }
      return returningTypeOneExpressionList;
  }
  </code></pre>
  
  <p>Thanks in advance.</p>