below is my work so far i have used 2 csv files and made 2 different arrays which represents 2 csv file data now what i am want to do that is i want to compare that 2 arrays and print the same vlaues or elements which are same in both arrays this is where i am having difficulty
import java.util.Arrays;
import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
public class CSVReaderw {
public static void main(String[] args) {
    String csvFile1 = "/Users/Documents/AD.csv";
    String csvFile2 = "/Users/Desktop/database.csv";
    BufferedReader br = null;
    String line = "";
    String cvsSplitBy = ",";
    String[] ad = null;
    String[] database = null;
    try {
        br = new BufferedReader(new FileReader(csvFile1));
        while ((line = br.readLine()) != null) {
            // use comma as separator
             ad = line.split(cvsSplitBy);
            //System.out.println("AD [id= " + ad[2] +"]");
        }
        System.out.println("second file result starts here");
        br = new BufferedReader(new FileReader(csvFile2));
        while ((line = br.readLine()) != null) {
           database = line.split(cvsSplitBy);
           //System.out.println("ID =" + database[0]);
        }
        List<String> commonListLambda = Arrays.stream(database)
        .filter(x -> Arrays.asList(ad).contains(x))
        .collect(Collectors.toList());
        System.out.println(commonListLambda);
            // List<String> commonList = new ArrayList<>();
// 
//             for(int i = 0; i < ad.length; i++){
//                 if(Arrays.asList(databse).contains(ad[i]))
//                     commonList.add(ad[i]);
//                  }
//             
//             System.out.println(commonList);
    } catch (FileNotFoundException e) {
        e.printStackTrace();
    } catch (IOException e) {
        e.printStackTrace();
    } finally {
        if (br != null) {
            try {
                br.close();
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
    }
}
}
Edit: see the updated code as we dicuessed here
 
    