Fix elvis operator documentation

This commit is contained in:
Lee Hinman 2017-07-25 12:50:09 -06:00
parent 6e79062078
commit faee825fea
1 changed files with 4 additions and 4 deletions

View File

@ -1700,10 +1700,10 @@ elvis: expression '?:' expression;
*Examples:*
[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
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
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
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
----
==== Assignment