Quantcast
Channel: Multiple conditional if() statements in Java? - Stack Overflow
Viewing all articles
Browse latest Browse all 6

Answer by Mạnh Quyết Nguyễn for Multiple conditional if() statements in Java?

$
0
0

You can do it by stream.

List<Integer> vars = new ArrayList<>();vars.add(a);vars.add(b);if (vars.stream().noneMatch(v -> v == 0)) {   // No variable = 0. Do something} else {   // Do something}

Viewing all articles
Browse latest Browse all 6

Trending Articles



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