[Solved] Create a list comprised of items missing in a list [closed]


There are many ways to compute managerNotFoundInManagerStoreIdList. Here’s the simplest one:

Create a set of manager and look it up:

Set<String> managers = managerStoreIdList.stream().map(ManagerStoreId::getManager)
    .collect(Collectors.toSet());

List<String> managerNotFoundInManagerStoreIdList = Manager.stream()
    .filter(m -> !managers.contains(m))
    .collect(Collectors.toList());

solved Create a list comprised of items missing in a list [closed]