Quantcast
Channel: Is it correct to use multiple OR conditions in one if statement, what are alternatives? - Stack Overflow
Browsing all 3 articles
Browse latest View live

Answer by Duncan Jones for Is it correct to use multiple OR conditions in one...

fge's solution is certainly clever and reduces the lines of code. However, I feel some of the meaning is lost when glancing at that snippet of code.I would encourage you to embrace readable code, even...

View Article



Answer by fge for Is it correct to use multiple OR conditions in one if...

You can do something like this:if (Arrays.asList(text1, text2, etc).contains(""))But a better solution would depend on the context.Note however that this is a little slower than your current code. If...

View Article

Is it correct to use multiple OR conditions in one if statement, what are...

I would like to know which way is more suitable and efficient in achieving something like: checking if text was entered in a fieldif(text1.equals("") || text2.equals("") || text3.equals("") ||...

View Article
Browsing all 3 articles
Browse latest View live




Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>
<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596344.js" async> </script>