I am moving from scala to java8 and looking for examples on how to assign value to a variable by computing block of code with multiple if's.
Given Scala code for reference.
Below works in Scala
object HelloWorld {
def main(args: Array[String]) = {
val x = if(condition1) {
....
....
....
if(condition2){
....
....
"something1"
}else
"something2"
}
else
"mydefault"
println(x)
}
Is there any style of coding other than below inline function example.
String x = (args.length > 0)? args[0]:"default";
But, how to write the same in Java8 programming style ?