/**
 * This function takes a list of values as input and returns the first and last values.
 * If the input list is empty or contains only null values, it returns null for both first and last.
 * If the input list contains a mix of null and other values, it skips over the null values and returns the actual first and last values.
 *
 * @param values A list of values
 * @return Pair containing the first non-null value in the list, or null if the list is empty or contains only null values,
 * and the last non-null value in the list, or null if the list is empty or contains only null values
 */
fun getFirstLast(values: List<Any?>): Pair<Any?, Any?> {

    var first: Any? = null
    var last: Any? = null

    if (values.isEmpty()) {
        return Pair(null, null)
    }

    for (value in values) {
        if (value != null) {
            first = value
            break
        }
    }

    for (value in values.reversed()) {
        if (value != null) {
            last = value
            break
        }
    }

    return Pair(first, last)
}
/**
 * This function takes a list of values as input and returns the first and last values.
 * If the input list is empty or contains only null values, it returns null for both first and last.
 * If the input list contains a mix of null and other values, it skips over the null values and returns the actual first and last values.
 *
 * @param values A list of values
 * @return Pair containing the first non-null value in the list, or null if the list is empty or contains only null values,
 * and the last non-null value in the list, or null if the list is empty or contains only null values
 */
fun getFirstLast(values: List<Any?>): Pair<Any?, Any?> {
/**
 * This function takes a list of values as input and returns the first and last values.
 * If the input list is empty or contains only null values, it returns null for both first and last.
 * If the input list contains a mix of null and other values, it skips over the null values and returns the actual first and last values.
 *
 * @param values A list of values
 * @return Pair containing the first non-null value in the list, or null if the list is empty or contains only null values,
 * and the last non-null value in the list, or null if the list is empty or contains only null values
 */
fun getFirstLast(values: List<Any?>): Pair<Any?, Any?> {

    var first: Any? = null
    var last: Any? = null

    if (values.isEmpty()) {
        return Pair(null, null)
    }

    for (value in values) {
        if (value != null) {
            first = value
            break
        }
    }

    for (value in values.reversed()) {
        if (value != null) {
            last = value
            break
        }
    }

    return Pair(first, last)
}