-4

I have two string arrays

array1={"Hardware Docs","Customer Data","Customer Docs","Commit Reviews","Product Planning Docs","Business Operations ","Proprietary"};
array2={"Hardware Docs","Customer Docs"};

I want uncommon strings from both of these arrays.can anyone suggest how to do it.

Stefan Freitag
  • 3,578
  • 3
  • 26
  • 33
Stack User
  • 59
  • 10

1 Answers1

-1
    String [] array1={"Hardware Docs","Customer Data","Customer Docs","Commit Reviews","Product Planning Docs","Business Operations ","Proprietary"};
    String[] array2={"Hardware Docs","Customer Docs"};

    ArrayList<String> filter1 = new ArrayList<>();

    for(String str1: array1){
        boolean match = false;
        for(String str2: array2){
            if(str1.equals(str2))
                match = true;
        }
        if(!match)
            filter1.add(str1);
    }

but this is soo brute force. If performance is important for you, you should look for better solutions

mBogaz
  • 136
  • 12