/**
 * This function takes in two lists and returns a new list containing the elements that are common in both lists.
 * However, if any of the lists contain the value 'null' or are empty, that list is skipped and not considered
 * for finding common elements. The function only considers non-'null' elements from both lists.
 *
 * @param list1 A list of elements
 * @param list2 A list of elements
 * @return A list containing the elements that are common in both lists, excluding 'null' elements and empty lists.
 *
 * Example:
 * findNoneElements(listOf(1, 2, 3, null, 4), listOf(3, 4, 5, 6, null)) -> [3, 4]
 */
fun findNoneElements(list1: List<Any?>, list2: List<Any?>): List<Any?> {

    if (list1.isEmpty() || list2.isEmpty() || list1.any { it == null } || list2.any { it == null }) {
        return emptyList()
    }

    return list1.filter { it != null && it in list2 }
}
/**
 * This function takes in two lists and returns a new list containing the elements that are common in both lists.
 * However, if any of the lists contain the value 'null' or are empty, that list is skipped and not considered
 * for finding common elements. The function only considers non-'null' elements from both lists.
 *
 * @param list1 A list of elements
 * @param list2 A list of elements
 * @return A list containing the elements that are common in both lists, excluding 'null' elements and empty lists.
 *
 * Example:
 * findNoneElements(listOf(1, 2, 3, null, 4), listOf(3, 4, 5, 6, null)) -> [3, 4]
 */
fun findNoneElements(list1: List<Any?>, list2: List<Any?>): List<Any?> {
/**
 * This function takes in two lists and returns a new list containing the elements that are common in both lists.
 * However, if any of the lists contain the value 'null' or are empty, that list is skipped and not considered
 * for finding common elements. The function only considers non-'null' elements from both lists.
 *
 * @param list1 A list of elements
 * @param list2 A list of elements
 * @return A list containing the elements that are common in both lists, excluding 'null' elements and empty lists.
 *
 * Example:
 * findNoneElements(listOf(1, 2, 3, null, 4), listOf(3, 4, 5, 6, null)) -> [3, 4]
 */
fun findNoneElements(list1: List<Any?>, list2: List<Any?>): List<Any?> {

    if (list1.isEmpty() || list2.isEmpty() || list1.any { it == null } || list2.any { it == null }) {
        return emptyList()
    }

    return list1.filter { it != null && it in list2 }
}