/**
 * This exercise is designed for a psychologist to practice working with the intersection of None and list methods.
 *
 * Your task is to write a function that takes two lists as arguments and returns their intersection.
 * The intersection of two lists is a new list that contains only the elements that are present in both lists.
 *
 * For example:
 * - For list1 = [1, 2, 3, 4] and list2 = [3, 4, 5, 6], the function should return [3, 4].
 * - For list1 = [1, 2, 3] and list2 = [4, 5, 6], the function should return an empty list as there are no common elements.
 *
 * Your task is to complete the code below to solve this exercise. You can use any list methods, as well as null to check for empty lists
 * or create an empty result list when there are no common elements.
 */
fun intersectionOfNoneAndListMethods(list1: List<Int>?, list2: List<Int>?): List<Int>? {

    if (list1 == null || list2 == null) {
        return null
    }

    // Find the intersection of the two input lists
    val intersection = list1.intersect(list2).toList()
    return intersection
}
/**
 * This exercise is designed for a psychologist to practice working with the intersection of None and list methods.
 *
 * Your task is to write a function that takes two lists as arguments and returns their intersection.
 * The intersection of two lists is a new list that contains only the elements that are present in both lists.
 *
 * For example:
 * - For list1 = [1, 2, 3, 4] and list2 = [3, 4, 5, 6], the function should return [3, 4].
 * - For list1 = [1, 2, 3] and list2 = [4, 5, 6], the function should return an empty list as there are no common elements.
 *
 * Your task is to complete the code below to solve this exercise. You can use any list methods, as well as null to check for empty lists
 * or create an empty result list when there are no common elements.
 */
fun intersectionOfNoneAndListMethods(list1: List<Int>?, list2: List<Int>?): List<Int>? {
/**
 * This exercise is designed for a psychologist to practice working with the intersection of None and list methods.
 *
 * Your task is to write a function that takes two lists as arguments and returns their intersection.
 * The intersection of two lists is a new list that contains only the elements that are present in both lists.
 *
 * For example:
 * - For list1 = [1, 2, 3, 4] and list2 = [3, 4, 5, 6], the function should return [3, 4].
 * - For list1 = [1, 2, 3] and list2 = [4, 5, 6], the function should return an empty list as there are no common elements.
 *
 * Your task is to complete the code below to solve this exercise. You can use any list methods, as well as null to check for empty lists
 * or create an empty result list when there are no common elements.
 */
fun intersectionOfNoneAndListMethods(list1: List<Int>?, list2: List<Int>?): List<Int>? {

    if (list1 == null || list2 == null) {
        return null
    }

    // Find the intersection of the two input lists
    val intersection = list1.intersect(list2).toList()
    return intersection
}