diff --git a/docs/painless/painless-operators.asciidoc b/docs/painless/painless-operators.asciidoc index 58e2fab2b0a..2ed0fb6d4be 100644 --- a/docs/painless/painless-operators.asciidoc +++ b/docs/painless/painless-operators.asciidoc @@ -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