Quantcast
Channel: Multiple OR conditions in if statements - Stack Overflow
Browsing latest articles
Browse All 4 View Live

Answer by user1428716 for Multiple OR conditions in if statements

The best way to code is to do null check.Ideally I would have code like this : while (iterator.hasNext()) { Map.Entry pairs = (Map.Entry)iterator.next(); Notification message = (Notification)...

View Article



Answer by tucuxi for Multiple OR conditions in if statements

I would refactor the message-matching code into the NotificationSearchCriteria class. The if would end up being "if (notificationSearchCriteria.matches(message))". From the names, I am guessing that is...

View Article

Answer by JohnnyO for Multiple OR conditions in if statements

This is most likely caused by one of the methods on message returning null. For example, if message.getDescription() returns null, then message.getDescription().equals(<something>) will throw a...

View Article

Multiple OR conditions in if statements

I have created a method that uses an iterator that iterates through a map and for each pair it evaluates a statement with many OR conditions. If the condition is true, it adds the object of the pair (a...

View Article
Browsing latest articles
Browse All 4 View Live




Latest Images