Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Scala check if List contains slice of element of other List

Tags:

list

scala

A : List[String] 
B : List[String]

I want to know if any element of List B is a slice of any element of list A.

Whats the fastest way to check it?

like image 300
Pius Friesch Avatar asked Sep 05 '25 03:09

Pius Friesch


1 Answers

I think the shortest way is: ListA.exists{ListB.contains}

like image 124
Ben Avatar answered Sep 07 '25 20:09

Ben