可以使用三元运算符简化代码,如下:

differentColumns.add((oldValue != null && newValue != null) ? (!oldValue.equals(newValue) ? column : null) : (oldValue == null && newValue != null || oldValue != null && newValue == null ? column : null));

Java代码优化:使用三元运算符简化比较判断