What is the most efficient way to create empty ListBuffer ?
val l1 = new mutable.ListBuffer[String]val l2 = mutable.ListBuffer[String] ()val l3 = mutable.ListBuffer.empty[String]
There are any pros and cons in difference?
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.
Order by efficient:
new mutable.ListBuffer[String]mutable.ListBuffer.empty[String]mutable.ListBuffer[String] ()You can see the source code of
ListBuffer&GenericCompanion