default to the actual value if a variable is missi...
# codereview
t
default to the actual value if a variable is missing?
Copy code
return carListings.filter {
    (selectedCarModelId ?: it.model_id) == it.model_id &&
    (selectedCarSubModelId ?: it.submodel_id) == it.submodel_id &&
    (selectedCarTrimId ?: it.trim_id) == it.trim_id &&
    (budgetValue :? it.price) <= budgetValue &&
    (fromYearSelected :? it.year) >= (fromYearSelected :? it.year) &&
    (toYearSelected ?: it.year) <= (toYearSelected ?: it.year) &&
    (mileageValue ?: it.mileage) <= mileageValue
}