/* package whatever; // don't place package name! */
import java.util.*;
import java.lang.*;
import java.io.*;
/* Name of the class has to be "Main" only if the class is public. */
class Ideone
{
public static void main
(String[] args
){ System.
out.
println(withIfElse
(null,
null)); System.
out.
println(withTernary
(null,
null)); }
return val == null ? defVal : "true".equalsIgnoreCase(val);
}
if (val == null) return defVal;
else return "true".equalsIgnoreCase(val);
}
}
LyogcGFja2FnZSB3aGF0ZXZlcjsgLy8gZG9uJ3QgcGxhY2UgcGFja2FnZSBuYW1lISAqLwoKaW1wb3J0IGphdmEudXRpbC4qOwppbXBvcnQgamF2YS5sYW5nLio7CmltcG9ydCBqYXZhLmlvLio7CgovKiBOYW1lIG9mIHRoZSBjbGFzcyBoYXMgdG8gYmUgIk1haW4iIG9ubHkgaWYgdGhlIGNsYXNzIGlzIHB1YmxpYy4gKi8KY2xhc3MgSWRlb25lCnsKICAgIHB1YmxpYyBzdGF0aWMgdm9pZCBtYWluKFN0cmluZ1tdIGFyZ3MpewogICAgICAgIFN5c3RlbS5vdXQucHJpbnRsbih3aXRoSWZFbHNlKG51bGwsIG51bGwpKTsKICAgICAgICBTeXN0ZW0ub3V0LnByaW50bG4od2l0aFRlcm5hcnkobnVsbCwgbnVsbCkpOwogICAgfQoKICAgIHByaXZhdGUgc3RhdGljIEJvb2xlYW4gd2l0aFRlcm5hcnkoU3RyaW5nIHZhbCwgQm9vbGVhbiBkZWZWYWwpewogICAgICAgIHJldHVybiB2YWwgPT0gbnVsbCA/IGRlZlZhbCA6ICJ0cnVlIi5lcXVhbHNJZ25vcmVDYXNlKHZhbCk7CiAgICB9CgogICAgcHJpdmF0ZSBzdGF0aWMgQm9vbGVhbiB3aXRoSWZFbHNlKFN0cmluZyB2YWwsIEJvb2xlYW4gZGVmVmFsKXsKICAgICAgICBpZiAodmFsID09IG51bGwpIHJldHVybiBkZWZWYWw7CiAgICAgICAgZWxzZSByZXR1cm4gInRydWUiLmVxdWFsc0lnbm9yZUNhc2UodmFsKTsKICAgIH0KfQ==