Java Lambda - finding if any String element of list matches partially with any element of another list

Viewed 3190

I've 2 lists of String

A = {"apple", "mango", "pineapple", "banana", ... }

B = {"app", "framework",...}

What I'm looking for is this: is any element of B at least a partial match ( substring/contains/startsWith ) with any element of A. e.g., 1st element of B 'app' matches partially with at least one element 'apple'.

Other closely matching topics on StackOverflow don't consider 2 lists.

Is there any elegant way to express a solution using Java lambda?

I feel it's a general problem in Search domain. So, if there is any helping or interesting read on this topic, I'd be glad to receive pointers.

2 Answers
Related