Suppose I have
val dirty = List("a", "b", "a", "c")
Is there a list operation that returns “a”, “b”, “c”
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.
Have a look at the ScalaDoc for Seq,
Update. Others have suggested using
Setrather thanList. That’s fine, but be aware that by default, theSetinterface doesn’t preserve element order. You may want to use a Set implementation that explicitly does preserve order, such as collection.mutable.LinkedHashSet.