How To Append A List In Scala | Edureka Community
Maybe your like
- Home
- Community
- Categories
- Apache Spark
- How to append a list in Scala
- apache-scala
- apache-spark
- big-data
Jul 26, 2019 in Apache Spark by Nishant • 6,904 views answer comment - flag
Your comment on this question:
| Your name to display (optional): |
| Email me at this address if a comment is added after mine: |
| Privacy: Your email address will only be used for sending these notifications. |
| Add comment Cancel |
1 answer to this question.
Your answer
| Your name to display (optional): |
| Email me at this address if my answer is selected or commented on: |
| Privacy: Your email address will only be used for sending these notifications. |
| Add answer Cancel |
Hey,
For this purpose, we use the single value ‘:+’.
scala> var a=List.empty[String] a: List[String] = List() scala> a :+="red" scala> a :+="green" scala> a :+="blue" scala> aThe output will be:
List[String] = List(red, green, blue)
Now to append a list to it:
scala> a++=List("golden","bronze") scala> aThe output will be:
List[String] = List(red, green, blue, golden, bronze)
Hope this helps!!
If you need to learn more about Scala, It's recommended to join Scala Certification course today.
Thank you!
- flag
- ask related question
Your comment on this answer:
| Your name to display (optional): |
| Email me at this address if a comment is added after mine: |
| Privacy: Your email address will only be used for sending these notifications. |
| Add comment Cancel |
Related Questions In Apache Spark
0 votes 1 answerHow to search for a Key in a Scala Map?
Hey, The Map.contains() method will tell you if ...READ MORE
answered Jul 29, 2019 in Apache Spark by Gitika • 65,730 points • 1,844 views- apache-scala
- apache-spark
- big-data
How to format a string in Scala?
Hey, To format a string, use the .format ...READ MORE
answered Jul 31, 2019 in Apache Spark by Gitika • 65,730 points • 1,483 views- apache-scala
- apache-spark
- big-data
How to use uniform list in Scala?
Hey, The method List.fill() creates a list and ...READ MORE
answered Aug 1, 2019 in Apache Spark by Gitika • 65,730 points • 2,282 views- apache-scala
- apache-spark
- big-data
How to reverse a Scala list?
Hi, This reverses the order of elements in ...READ MORE
answered Aug 1, 2019 in Apache Spark by Gitika • 65,730 points • 2,081 views- apache-spark
- big-data
- apache-scala
How do I get number of columns in each line from a delimited file??
Instead of spliting on '\n'. You should ...READ MORE
answered Aug 7, 2019 in Apache Spark by ashish • 7,216 views- apache-spark
- big-data
- spark
- spark-dataframe
- spark-sql
- scala
- hadoop
Hadoop Mapreduce word count Program
Firstly you need to understand the concept ...READ MORE
answered Mar 16, 2018 in Data Analytics by nitinrawat895 • 11,380 points • 14,017 views- hadoop
- big-data
- bigdata
- mapreduce
- hdfs
hadoop.mapred vs hadoop.mapreduce?
org.apache.hadoop.mapred is the Old API org.apache.hadoop.mapreduce is the ...READ MORE
answered Mar 16, 2018 in Data Analytics by nitinrawat895 • 11,380 points • 4,831 views- hadoop
- big-data
- hdfs
- mapreduce
hadoop fs -put command?
Hi, You can create one directory in HDFS ...READ MORE
answered Mar 16, 2018 in Big Data Hadoop by nitinrawat895 • 11,380 points • 119,056 views- hadoop
- big-data
- bigdata
- hdfs
- mapreduce
How to execute a function in apache-scala?
Function Definition : def test():Unit{ var a=10 var b=20 var c=a+b } calling ...READ MORE
answered Aug 5, 2020 in Apache Spark by Ramkumar Ramasamy • 2,256 views- apache-scala
- programming
- bigdata
How can you use "for" statement in scala to print list from collection?
Hi, You can use for loop in scala using ...READ MORE
answered Jul 5, 2019 in Apache Spark by Gitika • 65,730 points • 1,553 views- apache-spark
- big-data
- apache-scala
Recent in Apache Spark
- How to import pyspark in Jupyter Apr 3, 2023
- How to import pyspark in Jupyter Notebook Apr 3, 2023
- How to read a nested avro file format in spark dataframe Nov 16, 2022
- How can i implement corss apply function of TSQL in pyspark May 30, 2022
- Pyspark: Aggregate and filtering code error Apr 22, 2022
- All categories
-
Generative AI (1,454) -
Power BI (1,316) -
DevOps & Agile (4,138) -
Data Science (100) -
ChatGPT (30) -
Cyber Security & Ethical Hacking (1,057) -
Data Analytics (1,266) -
Cloud Computing (4,053) -
Machine Learning (337) -
PMP (1,069) -
Python (3,488) -
SalesForce (201) -
Selenium (1,624) -
Software Testing (58) -
Tableau (608) -
Web Development (3,972) -
UI UX Design (24) -
Java (1,358) -
Azure (157) -
Database (858) -
Big Data Hadoop (1,907) -
Blockchain (1,673) -
Digital Marketing (121) -
C# (141) -
C++ (272) -
IoT (Internet of Things) (390) -
Kotlin (8) -
Linux Administration (389) -
MicroStrategy (7) -
Mobile Development (395) -
Others (2,386) -
RPA (653) -
Talend (73) -
TypeSript (124) -
Apache Kafka (84) -
Apache Spark (596) -
Career Counselling (1,091) -
Events & Trending Topics (28) -
Ask us Anything! (71)
Join the world's most active Tech Community!
Welcome back to the World's most active Tech Community!
Sign up with Gmail Sign up with FacebookOR
Password must haveAt least 1 upper-case and 1 lower-case letter
Minimum 8 characters and Maximum 50 characters
SIGN UP Already have an Edureka Account? Login Forgot Password? LOGIN Don’t have edureka account? Sign Up resend ? Password must haveAt least 1 upper-case and 1 lower-case letter
Minimum 8 characters and Maximum 50 characters
reset password Don’t have edureka account? Sign Up reset password Don’t have edureka account? Sign Up Send Code Don’t have edureka account? Sign UpSubscribe to our Newsletter, and get personalized recommendations.
Already have an account? Sign in.
Tag » Add Element List Scala
-
How To Add Elements To A List In Scala (List, ListBuffer)
-
How To Add Elements To A List In Scala
-
Scala Append To List - Linux Hint
-
Appending An Element To The End Of A List In Scala - Stack Overflow
-
11.3. Adding Elements To A List - Scala Cookbook [Book] - O'Reilly
-
How To Append List In Scala With Examples - EduCBA
-
Ajouter Des éléments à La Liste Dans Scala | Delft Stack
-
How To Add Elements To A List In Scala?
-
Scala - Lists - Tutorialspoint
-
Add Element To A List In Scala
-
The List Class | Scala Book
-
Scala Programming: Add Each Element N Times To A Given List Of ...
-
Scala Append List To List
-
Append To A List Scala Code Example
-
Lists In Scala - DataCamp
-
How To Find The Sum Of Elements Of An Array In Scala
-
List - Scala Documentation
-
Arrays And Lists - Scala Succinctly Ebook - Syncfusion
-
Scala ListBuffer - GeeksforGeeks
Generative AI
Power BI
DevOps & Agile
Cyber Security & Ethical Hacking
Data Analytics
Cloud Computing
Machine Learning
Python
Selenium
Software Testing
Tableau
Web Development
Java
Database
Big Data Hadoop
Blockchain
IoT (Internet of Things)
Linux Administration
MicroStrategy
RPA
Talend
Apache Kafka
Apache Spark
Career Counselling
Events & Trending Topics