You could try using Collections now renames to Guava
Get the jar file from here
Since the length of the array list is different what you can do is:
1.Get the lengh of the array with the largest size
int sizeOfArrayOne = array.length;
int sizeOfArrayTwo = array2.length;
compare the sizes
2.Once you obtain which array is the largest you could then use Guava to find for you the values from another array like:
String value = Iterables.find(arrayWithLargerSize, new SearchForString(arrayOfSmallerSize[i]),null);
if(value == null) {
// the string is not present in the array
}else {
// the string is present in the array
}
Run this block inside a loop of the smaller array (the i represents the i for the loop).
3.Write the search predicate class like this:
class SearchForString implements Predicate<String> {
// override the methods here
// also ensure that you implement the correct predicate
// one that belongs to the guava collection
}
Hope this clue suffices!
for loopsforcontains... since only 1 array is looping.. forArrayListit is pretty much the same.. alsocontainsfunction should do the trickaarray( you are not usinga[j].contains..).. you are checking thebvalue with wholeaa.lengthtime.. the contains function loop throughaby default.