In my business case I need to pick codes of cola brands which has assigned third party dealers with codes.
I need to crosscheck all the dealer codes currently in contract are correct and no outside code is entered. To do that I have master list of codes.
See the sample data I have
List<String> mixedOfLAndPCodes = ["L123", "P123", "P234", "", "P2345", ""];
List<String> masterPCodes = ["P123", "P234", "P2345", "P111", "P23456"];
String masterLCode = "L123";
How can I be sure that all mixedOfLAndPCodes
are available in master code list with java stream
?
Code I wrote is something like
boolean a = mixedOfLAndPCodes.stream().allMatch(it -> masterLCode.equals(it) || masterPCodes.contains(it));
Not able to figure out if that is enough to test my case or some improvements needed.