object MyBlog {
def main(args: Array[String]): Unit = {
concatExample()
}
def concatExample(): Unit = {
val input1 = List(1,2,3,4,5)
val input2 = List(11,12,13,14,15)
val res = input1 concat(input2)
println(res) //List(1, 2, 3, 4, 5, 11, 12, 13, 14, 15)
}
}
Saturday, 7 May 2022
Scala Function - concat
Concat create new collection by adding given collections
Subscribe to:
Post Comments (Atom)
-
Distinct - It creates a copy of a given collection without duplicated elements DistinctBy - It also creates a copy given collection by kee...
-
Java is impatient, So it does things eagerly, Doing lazy things with Java is not straightforward! Let's first understand What do we m...
-
MongoDB is NoSQL Open Source database. It's document based database. Let's take an example to store cricket bat object: Cricket...
-
Eclipse Idea Usage F3 ctrl + b go to declaration (e.g. go to method) ctrl + l ctrl + g go to line ctrl + y ctrl + shift + z red...
-
Scala Collection - Combinations combinations creates the list of all the possible combinations from given collection by taking "n...
-
RDD stands for resilient (restore in case of failure) distributed dataset. RDD is an immutable structure/collection. RDD divide the data in...
-
Scala Collection - aggregateExample Use with Par function - It will split input in multiple collection and execute them parallel into 2 step...
-
Shuffle operation is the most expensive operation in Spark as takes a lot of I/O, networks calls. Why we need shuffle operation: While ru...
-
apply and unapply are the special methods in Scala. The apply method works like a constructor. Unapply uses to extract the object. The ...
-
The corresponds checks two collection indexes by index using the given predicate. Here isEven is a predicate that checks whether input numb...
No comments:
Post a Comment