I think the below code is difficult to understand. I also feel it abuses Java's ternary operator.
String name = ((this.getAllNamesAsDelimitedString().contains(incomingName) ? incomingName: (CollectionsUtils.isEmptyCollection(this.getEntityOperationMap()) ? null : this.getEntityOperationMap.get(incomingName))));
getAllNamesAsDelimitedString will return a comma (
I'd prefer something instead of such a nested ternary operator, if it looks cleaner and easier to understand. It would also be easy to sort out merge issue in, say, SVN.
N.B: There are even more nested ternary conditions in the code that I just have taken over.
Is there any general guideline which suggests the number of levels a ternary operator should be allowed? In other words, any guideline suggesting when you should break your ternary operator for better code readability?