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...
-
Discover functionality in Scala libraries. URL: http://scala-search.org/
-
Function.Const create an anonymous function which return same output for any input or some fixed input. In below example it gives output 12 ...
-
apply and unapply are the special methods in Scala. The apply method works like a constructor. Unapply uses to extract the object. The ...
-
In Scala, objects are a singleton. Scala doesn’t have static class members (variables or methods). Instead, it has singleton objects. Sim...
-
Count defines how many elements in a given collection satisfy the input predicate. def countExample(): Unit = { def isEven = (input: In...
-
We generally have dev server and production Server. Usually, Dev server has less data(test data). While working on a Complex application, S...
-
Sometimes it is necessary to express that the type of an object is a subtype of several other types. In Scala, this can be expressed with t...
-
Diff computes the difference between LHS and RHS collection def diffExample(): Unit = { val input1 = List(5,4,3,2,1) val input2 =...
No comments:
Post a Comment