How to Sort The Array List in Java(WebDriver) - Bug Reaper

                  Bug Reaper

Lean about Automation Testing,Selenium WebDriver,RestAssured,Appium,Jenkins,JAVA,API Automation,TestNG,Maven, Rest API, SOAP API,Linux,Maven,Security Testing,Interview Questions

Monday 23 September 2013

How to Sort The Array List in Java(WebDriver)

List<String> unsortList = new ArrayList<String>();  

List<WebElement>data=cell.findElements(By.xpath("//td[5]"));
for(WebElement d:data)
{
if(org.apache.commons.lang.StringUtils.isNotBlank(d.getText()))// to avoid Blank Entries getting saved in List
{
unsortList.add(d.getText()); // Code Added
}
System.out.println(d.getText());
}


//to Sort the List------>   Collections.sort(unsortList);

No comments:

Post a Comment