Scala program to get the first element of Set using the head property
// Scala program to get the first element
// of Set using head property
import scala.collection.immutable._
object Sample {
// Main method
def main(args: Array[String]) {
//Set of cities.
val cities = Set("DELHI", "MUMBAI", "AGRA", "GWALIOR")
println("First element: " + cities.head);
}
}
Output
First element: DELHI