I have this comparison:
BigDecimal firstLimit = null; <<-------------------------sometimes firstLimit could be null
BigDecimal secondLimit = BigDecimal.valueof(10); <<--- sometimes secondLimit can be null
BigDecimal thirdLimit = BigDecimal.valueof(20); <<--- sometimes thirdLimit can be null
BigDecimal minLimit = firstLimit.min(secondLimit.min(thirLimit))
Initially I tried to set any value that ends up being null with an arbitrary ceiling value but I am not allowed to do that. This means that I would need to get rid of this one line comparison solution for a lengthy if-else-if and I would really prefer not to. Is there an elegant way to handle the null case scenario. Any suggestions would be much appreciated. Thank you.