private static Collection intersection(Collection newList, Collection oldList)
{
Collection result = newList.clone(); // error in this line. Not sure why clone is not able to be accessed.
result.retainAll(oldList);
return result;
}
Collection<String> newFileList = new ArrayList<String>();
Collection<String> oldFileList = new ArrayList<String>();
//code to file the list from a text file.
Collection matched = intersection(newFileList , oldFileList );
|