def containsSliceExample(): Unit = {
val input = List(1,2,3,5,6,7)
val isSubCollectionExist = input.containsSlice(List(1,2))
println(isSubCollectionExist) // true
val isSubCollectionExist1 = input.containsSlice(List(1,2,9))
println(isSubCollectionExist1) // false
val isSubCollectionExist3 = input.containsSlice(List(1,2,3,4,5,6,7))
println(isSubCollectionExist3) // false
}
Saturday, 7 May 2022
Scala Function - containsSlice
ContainsSlice checks if input collection is part of given collection
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...
-
MongoDB is NoSQL Open Source database. It's document based database. Let's take an example to store cricket bat object: Cricket...
-
Java is impatient, So it does things eagerly, Doing lazy things with Java is not straightforward! Let's first understand What do we m...
-
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...
-
RDD stands for resilient (restore in case of failure) distributed dataset. RDD is an immutable structure/collection. RDD divide the data in...
-
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...
-
Scala Collection - Chain: Scala chain execute multiple function in sequence while taking same input type data as input. object MyBlog { d...
-
Discover functionality in Scala libraries. URL: http://scala-search.org/
-
Scala Collection - Combinations combinations creates the list of all the possible combinations from given collection by taking "n...
-
apply and unapply are the special methods in Scala. The apply method works like a constructor. Unapply uses to extract the object. The ...
No comments:
Post a Comment