How to get all option list using Selenium webdriver ?

package TechLearndotin;
import java.util.List;
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;
import org.testng.annotations.Test;
import org.testng.annotations.BeforeTest;
import org.testng.annotations.AfterTest;
import com.thoughtworks.selenium.Selenium;

public class TechLearn {
       public WebDriver driver;
       public Selenium selenium;

@Test 
        public void GetAllOptionsList() throws Exception {
        driver.get("http://techlearn.in/Register");
        Thread.sleep(3000);
       List<WebElement> allCities=new Select(driver.findElement(By.id("edit-submitted-country"))).getOptions();
         for(WebElement city:allCities)
         {
        System.out.println(city.getText()); 
         }
       
  }
@BeforeTest
        public void beforeTest() {
        driver= new FirefoxDriver();
        driver.manage().window().maximize();
        }

@AfterTest
        public void afterTest() {
        }
        }

Tags: