Verifying if one list contains a string from another list
The current code works but it is very awkward, as rolfl pointed out. I would add that you should never compare booleans with true or false, like what you're doing in:

} else if(k == models.size() - 1 &amp;&amp; flag == false) {                        
    return false;
}


Instead, have

} else if (k == models.size() - 1 &amp;&amp; !flag) {                        
    return false;
}




You can actually accomplish this task in a single, clear and easy line using the Stream API:

public boolean compareTwoList(List&lt;String&gt; models, List&lt;String&gt; titleOfVehicles) {
    return titleOfVehicles.stream().allMatch(t -&gt; models.stream().anyMatch(t::contains));
}


This does exactly what is written: it returns whether all elements in the given titles contains any of the given models.

Both allMatch and anyMatch are short-circuiting operations, so it will behave exactly like your current code.