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

import com.bonus.canteen.core.menu.domain.MenuDishes;

import java.util.HashSet;
import java.util.List;
import java.util.Set;
import java.util.stream.Collectors;

/**
 * @author xliu
 * @date 2025/5/9 11:20
 */
public class DifferenceCalculator {
    public static Set<String> calculateDifference(Set<String> stringSet, List<MenuDishes> menuDishesList) {
        // 从menuDishesList中提取所有dishesName的集合
        Set<String> menuDishesNames = menuDishesList.stream()
                .map(MenuDishes::getDishesName)
                .collect(Collectors.toSet());

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

        return difference;
    }
}
