I have a set which has list of Obects of type TempDTO.
public class TempDTO {
public String code;
//getter
//setter
}
Set<TempDTO> tempSet = service.getTempList();
tempSet has values whose code is ["01", "02", "04", "05"];
String[] lst = ["01", "02"]
I want to loop tempSet compare value with that of in lst array and I need a list of values when value doesn't match. out put expected is : ["04", "05"] I tried,
for(int i=0; i < lst.length; i++){
String st = lst[i];
tempSet.stream().forEach(obj -> {
if((obj.getCode().equals(st) )){
logger.debug(" equal " + obj.getCode());
} else {
logger.debug("not equal " + obj.getCode());
}
});
}