package com.ruoyi.common.core.utils;

import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;

/**
 * 业务模块
 *
 * @author tianyongbao
 * @date 2023/12/14
 */
public class ListUtils {

    public static <T> List<T> removeElementFromList(List<T> list, T element) {
        List<T> modifiedList = new ArrayList<>(list); // 复制原始列表

        Iterator<T> iterator = modifiedList.iterator();
        while (iterator.hasNext()) {
            if (element.equals(iterator.next())) {
                iterator.remove();
            }
        }

        return modifiedList;
    }
}
