title: How do verify ascending order of string values for an array list?
body: <p>I am using Selenium Webdriver with Java binding and I'm testing a sorting functionality whereby you have values arranged in an <code>arraylist = {"4"","4.5"","5.5""}</code>. So basically the string contains decimal points as well as double quotation. I have the following code below. The problem is that I keep getting false due to the fact that when it compares the current to previous, it comes with false. Thanks for your help </p>
  
  <pre><code>public Boolean checkAscendingOrderScreensize(List&lt;String&gt; list){
     if(list == null || list.isEmpty())
          return false;
      if(list.size() == 1)  
          return true;
      for(int i=1; i&lt;list.size();i++)
      {
          String current = list.get(i).toString();
          String previous = list.get(i-1).toString();
          current = current.replace(",",".");
          current = current.replace("\"", "");
          previous = previous.replace(",",".");
          previous = previous.replace("\"", "");
  
          if(current.compareTo(previous)&gt;0)
                  return false;
      }
      return true; 
  }
  </code></pre>