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...
-
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 ...
-
In Scala, objects are a singleton. Scala doesn’t have static class members (variables or methods). Instead, it has singleton objects. Sim...
-
apply and unapply are the special methods in Scala. The apply method works like a constructor. Unapply uses to extract the object. The ...
-
MongoDB is NoSQL Open Source database. It's document based database. Let's take an example to store cricket bat object: Cricket...
-
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...
-
We generally have dev server and production Server. Usually, Dev server has less data(test data). While working on a Complex application, S...
-
Self type is a way to tell trait that it depends on another trait. We can achieve dependency injection of trait using self type trait Tar...
No comments:
Post a Comment