Let’s imagine the following immutable Map:
val foo = Map((10,"ten"), (100,"one hundred"))
I want to get the key of the first element.
foo.head gets the first element. But what next?
I also want the value of this element, i.e. “ten”
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Set a key/value pair:
val (key, value) = foo.head