Fix elvis operator documentation
This commit is contained in:
parent
6e79062078
commit
faee825fea
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue