/**
 * Find the common artists between two lists of artists.
 *
 * @param artists1 A list of artists.
 * @param artists2 Another list of artists.
 * @return A list containing the common artists between the two provided lists.
 * @throws IllegalArgumentException If one or both of the provided lists is null.
 *
 * Example:
 * findCommonArtists(listOf("Pablo Picasso", "Vincent van Gogh", "Leonardo da Vinci"), listOf("Vincent van Gogh", "Edvard Munch"))
 * // Output: ["Vincent van Gogh"]
 * findCommonArtists(listOf("Claude Monet", "Salvador Dali"), listOf("Pablo Picasso", "Vincent van Gogh", "Claude Monet"))
 * // Output: ["Claude Monet"]
 */
fun findCommonArtists(artists1: List<String>?, artists2: List<String>?): List<String> {

    requireNotNull(artists1) { "Both lists of artists must be provided." }
    requireNotNull(artists2) { "Both lists of artists must be provided." }

    return artists1.filter { it in artists2 }
}
/**
 * Find the common artists between two lists of artists.
 *
 * @param artists1 A list of artists.
 * @param artists2 Another list of artists.
 * @return A list containing the common artists between the two provided lists.
 * @throws IllegalArgumentException If one or both of the provided lists is null.
 *
 * Example:
 * findCommonArtists(listOf("Pablo Picasso", "Vincent van Gogh", "Leonardo da Vinci"), listOf("Vincent van Gogh", "Edvard Munch"))
 * // Output: ["Vincent van Gogh"]
 * findCommonArtists(listOf("Claude Monet", "Salvador Dali"), listOf("Pablo Picasso", "Vincent van Gogh", "Claude Monet"))
 * // Output: ["Claude Monet"]
 */
fun findCommonArtists(artists1: List<String>?, artists2: List<String>?): List<String> {
/**
 * Find the common artists between two lists of artists.
 *
 * @param artists1 A list of artists.
 * @param artists2 Another list of artists.
 * @return A list containing the common artists between the two provided lists.
 * @throws IllegalArgumentException If one or both of the provided lists is null.
 *
 * Example:
 * findCommonArtists(listOf("Pablo Picasso", "Vincent van Gogh", "Leonardo da Vinci"), listOf("Vincent van Gogh", "Edvard Munch"))
 * // Output: ["Vincent van Gogh"]
 * findCommonArtists(listOf("Claude Monet", "Salvador Dali"), listOf("Pablo Picasso", "Vincent van Gogh", "Claude Monet"))
 * // Output: ["Claude Monet"]
 */
fun findCommonArtists(artists1: List<String>?, artists2: List<String>?): List<String> {

    requireNotNull(artists1) { "Both lists of artists must be provided." }
    requireNotNull(artists2) { "Both lists of artists must be provided." }

    return artists1.filter { it in artists2 }
}