Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

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.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 563189
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T12:38:01+00:00 2026-05-13T12:38:01+00:00

Why is the + operator for List deprecated in Scala? http://www.scala-lang.org/docu/files/api/scala/List.html#%2B%28B%29

  • 0

Why is the + operator for List deprecated in Scala?

http://www.scala-lang.org/docu/files/api/scala/List.html#%2B%28B%29

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T12:38:02+00:00Added an answer on May 13, 2026 at 12:38 pm

    Good question, so I looked it up in the book by Odersky et al. It says the following (hopefully it’s not a copyright infringement to quote this here ;-)):


    Why not append to lists?

    Class Listdoes not offer an append operation because the time it takes to append to a list grows linearly with the size of the list, whereas prepending with :: takes constant time. Your options if you want to build a list by appending elements is to prepend them, then when you’re done call reverse; or use a ListBuffer, a mutable list that does offer an append operation, and when you’re done call toList.


    As far as I understand FP, prepending to a list is much more common than appending, at least in pure functional languages. I can only assume that the designers of Scala added the + operator as a convenience for Java developers, who are used to appending using add(), and then had second thoughts about it.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

F# List provides the cons ( :: ) operator to add an item at
Can anyone explain why isn't the operator[] implemented for a std::list? I've searched around
In C++, I'm looking to implement an operator for selecting items in a list
struct Node { int value Node* next; } typedef List Node* const Set operator
I'm in the process of creating a double-linked list, and have overloaded the operator=
Possible Duplicate: ++ operator in Scala I want to increment an Int variable in
Does Perl's foreach loop operator require that the list items be presented in order?
To illustrate, I start with a list of 2-tuples: import itertools import operator raw
I am creating an explicit conversion operator to convert between a generic list of
Is there any way to use the in operator for a list with a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.