Fix elvis operator documentation
This commit is contained in:
parent
6e79062078
commit
faee825fea
|
@ -1701,7 +1701,7 @@ elvis: expression '?:' expression;
|
|||
[source,Java]
|
||||
----
|
||||
List l = new ArrayList(); // declares the List variable l and sets it to a newly allocated ArrayList
|
||||
List y = l : new ArrayList(); // declares the List variable y and sets it to l since l is not null
|
||||
List y = l ?: new ArrayList(); // declares the List variable y and sets it to l since l is not null
|
||||
y = null; // sets y to null
|
||||
def z = y ?: new HashMap(); // declares the def variable z and sets it to a newly allocated HashMap since y is null
|
||||
----
|
||||
|
|
Loading…
Reference in New Issue