Is anybody know how to validate a list of strings are in alphabetical order or not using java. I tried with compareTo() but I didn't get it.
* **It is only for the validation of String. If yes to print "List is in Alphabetical order" and No, to print "Not in order"
Here is the code:::
import java.util.concurrent.TimeUnit;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.support.ui.Select;
public class ValidationOfSelectDropDown_4 {
public static void main(String[] args) throws InterruptedException {
WebDriver driver=new FirefoxDriver();
driver.get("http://my.naukri.com/manager/createacc2.php?othersrcp=16201&err=1");
driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);
driver.manage().window().maximize();
WebElement single=driver.findElement(By.xpath("//select[@id='ugcourse']"));
Select dd=new Select(single);
String str=single.getText();
System.out.println(str);
}}
O/p of the String str is :
Select
Not Pursuing Graduation
B.A
B.Arch
BCA
B.B.A
...Up to end of the option