title: java.lang.ClassCastException: java.math.BigDecimal cannot be cast to java.lang.String
body: <p>I am trying to iterate a list which contains multiple Ids like this:</p>
  
  <p>[148066, 148065, 148064, 148063, 148062, 148061, 148060, 148059, 148058, 148057, 148056]</p>
  
  <pre><code>List&lt;String&gt; list= DbService.getPayUVerificationList();
  </code></pre>
  
  <p>where this above list object contains all the fetched Ids from DB. </p>
  
  <pre><code> if(null != list &amp;&amp; !list.isEmpty())
   {
       for (int i = 0; i &lt; list.size(); i++) {
  
              //System.out.println(list.get(i));
              //String txnId= list.get(i).toString();
              //String txnId = (String) list.get(i);
             //String txnId = (String) list.get(i);
              String txnId = (String) list.get(i).toString();
              String output=hdfcService.checkPayStatusByPayU(txnId);
          }
     }
  </code></pre>
  
  <p>but i am getting </p>
  
  <blockquote>
    <p>java.lang.ClassCastException: java.math.BigDecimal cannot be cast to java.lang.String</p>
  </blockquote>
  
  <p>I have tried lot of casting and approaches but all in vain. </p>
  
  <p><strong>Edit 1:</strong> As many are saying that this "list.get(i).toString()" should work but in my case this is still not working and i have no idea about this. </p>