I didn't find any thread here on this Question. I am trying to Remove elements (Cars in my case) of one list (cars1) if present in another list (cars2) using java stream. I tried using removeIf but then it felt like it works more appropriately with List of Strings, etc.
Car c1 = new Car();
c1.id = 1;
c1.name = "C1";
Car c2 = new Car();
c2.id = 2;
c2.name = "C2";
List<Car> cars1 = new ArrayList<Car>();
cars1.add(c1);
cars1.add(c2);
List<Car> cars2 = new ArrayList<Car>();
cars2.add(c2);
// TODO : Remove all the cars from cars1 list that are in cars2 list using java streams