October 2013
Beginner to intermediate
270 pages
5h 41m
English
The previous recipe mentions that a tMap expression cannot be more than a single line of Java code. This means that we cannot use the normal if-then-else logic to test for conditions.
Fortunately, Java does provide a mechanism by which we can perform tests on a single line: the ternary expression.
Open the job jo_cook_ch04_0030_ternaryExpressions.
We'll be looking at two similar scenarios using the ternary expression.
tMap and click the output singleTernaryLocality column.customer.countryOfBirth.equals("UK") ? "UK" : "RestOfWorld"Read now
Unlock full access