Skip to content
Advertisement

Java 8 Remove 1 List from Other

I have two list of different Objects.

JavaScript

I want to remove the list of School objects from List of World objects based on schoolName and location. I cannot use equals and hashCode methods on those two fields as it is creating some other problem. Please help me how it can be done using streams.

Advertisement

Answer

You can use filter:

JavaScript
User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement