/**
 * Given a set, a list of elements to remove, and a list of elements to add, modify the set using indexing.
 *
 * @param setData The set containing the elements.
 * @param elementsToRemove The list of elements to be removed from the set.
 * @param elementsToAdd The list of elements to be added to the set.
 * @return The modified set after removing elements and adding new elements.
 */
fun updateSetElements(setData: MutableSet<Any>, elementsToRemove: List<Any>, elementsToAdd: List<Any>): MutableSet<Any> {

    // Remove elements from the set using indexing
    for (element in elementsToRemove) {
        if (element in setData) {
            setData.remove(element)
        }
    }

    // Add elements to the set using indexing
    for (element in elementsToAdd) {
        setData.add(element)
    }

    return setData
}
/**
 * Given a set, a list of elements to remove, and a list of elements to add, modify the set using indexing.
 *
 * @param setData The set containing the elements.
 * @param elementsToRemove The list of elements to be removed from the set.
 * @param elementsToAdd The list of elements to be added to the set.
 * @return The modified set after removing elements and adding new elements.
 */
fun updateSetElements(setData: MutableSet<Any>, elementsToRemove: List<Any>, elementsToAdd: List<Any>): MutableSet<Any> {
/**
 * Given a set, a list of elements to remove, and a list of elements to add, modify the set using indexing.
 *
 * @param setData The set containing the elements.
 * @param elementsToRemove The list of elements to be removed from the set.
 * @param elementsToAdd The list of elements to be added to the set.
 * @return The modified set after removing elements and adding new elements.
 */
fun updateSetElements(setData: MutableSet<Any>, elementsToRemove: List<Any>, elementsToAdd: List<Any>): MutableSet<Any> {

    // Remove elements from the set using indexing
    for (element in elementsToRemove) {
        if (element in setData) {
            setData.remove(element)
        }
    }

    // Add elements to the set using indexing
    for (element in elementsToAdd) {
        setData.add(element)
    }

    return setData
}