Method chaining: Difference between revisions

Content deleted Content added
Examples: Add note of the JavaScript chaining code
 
(2 intermediate revisions by 2 users not shown)
Line 26:
| publisher = [[Prentice Hall]]
| year = 2008
| isbn = 978-0-13-235088-24
}}</ref>
 
Line 37:
 
Compare:
<syntaxhighlight lang="cpp">
a << b << c;
</syntaxhighlight>
equivalent to:
<syntaxhighlight lang="cpp">
a << b;
a << c;
Line 47:
 
Another example in [[JavaScript]] uses the built-in methods of Array:
<syntaxhighlight lang="javascript">filter
const interesting_products = products
somethings
.filter(x => x.count > 10)
.sort((a, b) => a.count - b.count)
Line 69:
* [http://www.infoq.com/articles/internal-dsls-java Creating DSLs in Java using method chaining concept]
* [https://programmingdive.com/method-chaining-in-php/ Method Chaining in PHP]
 
{{Design patterns}}
 
{{DEFAULTSORT:Method Chaining}}