@@ -1087,8 +1087,8 @@ the expression. A minimal example is:
1087
1087
"false ? 'trueExp' : 'falseExp'").getValue(String.class);
1088
1088
----
1089
1089
1090
- In this case, the boolean false results in returning the string value `'falseExp'`. A more
1091
- realistic example is shown below.
1090
+ In this case, the boolean false results in returning the string value `'falseExp'`.
1091
+ A more realistic example is shown below.
1092
1092
1093
1093
[source,java,indent=0]
1094
1094
[subs="verbatim,quotes"]
@@ -1112,10 +1112,10 @@ ternary operator.
1112
1112
[[expressions-operator-elvis]]
1113
1113
=== The Elvis Operator
1114
1114
1115
- The Elvis operator is a shortening of the ternary operator syntax and is used in the
1116
- http://www.groovy-lang.org/operators.html#_elvis_operator[Groovy] language.
1117
- With the ternary operator syntax you usually have to repeat a variable twice, for
1118
- example:
1115
+ The Elvis operator is a shortening of the ternary operator syntax and is used in
1116
+ the http://www.groovy-lang.org/operators.html#_elvis_operator[Groovy] language.
1117
+ With the ternary operator syntax, you usually have to repeat a variable twice,
1118
+ as the following example shows :
1119
1119
1120
1120
[source,groovy,indent=0]
1121
1121
[subs="verbatim,quotes"]
@@ -1124,7 +1124,8 @@ example:
1124
1124
String displayName = (name != null ? name : "Unknown");
1125
1125
----
1126
1126
1127
- Instead you can use the Elvis operator, named for the resemblance to Elvis' hair style.
1127
+ Instead, you can use the Elvis operator (named for the resemblance to Elvis' hair style).
1128
+ The following example shows how to use the Elvis operator:
1128
1129
1129
1130
[source,java,indent=0]
1130
1131
[subs="verbatim,quotes"]
@@ -1135,7 +1136,7 @@ Instead you can use the Elvis operator, named for the resemblance to Elvis' hair
1135
1136
System.out.println(name); // 'Unknown'
1136
1137
----
1137
1138
1138
- Here is a more complex example.
1139
+ The following listing shows a more complex example:
1139
1140
1140
1141
[source,java,indent=0]
1141
1142
[subs="verbatim,quotes"]
0 commit comments