I have two array lists e.g.
List a;
contains : 10/10/2014, 10/11/2016
List b;
contains : 10/10/2016
How can i do
You can use filter in the Java 8 Stream library
List aList = List.of("l","e","t","'","s");
List bList = List.of("g","o","e","s","t");
List difference = aList.stream()
.filter(aObject -> {
return ! bList.contains(aObject);
})
.collect(Collectors.toList());
//more reduced: no curly braces, no return
List difference2 = aList.stream()
.filter(aObject -> ! bList.contains(aObject))
.collect(Collectors.toList());
Result of System.out.println(difference);:
[e, t, s]