package com.bonus.canteen.core.cook.utils;

import com.bonus.canteen.core.cook.domain.CookDishes;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import java.util.stream.Collectors;

public class DifferenceCalculator {
    public static Set<String> calculateDifference(Set<String> stringSet, List<CookDishes> menuDishesList) {
        // 从menuDishesList中提取所有dishesName的集合
        Set<String> menuDishesNames = menuDishesList.stream()
                .map(CookDishes::getDishesName)
                .collect(Collectors.toSet());

        // 计算差集：stringSet中有而menuDishesNames中没有的元素
        Set<String> difference = new HashSet<>(stringSet);
        difference.removeAll(menuDishesNames);

        return difference;
    }
}
