Welcome, Guest: Register On Nairaland / LOGIN! / Trending / Recent / New
Stats: 3,150,766 members, 7,809,945 topics. Date: Friday, 26 April 2024 at 05:38 PM

Method Chaining In Java - Programming - Nairaland

Nairaland Forum / Science/Technology / Programming / Method Chaining In Java (823 Views)

Pro JS Devs, Please Is This Variable Chaining / How To Sort Array In Java With User Defined Method ? / Question On Regular Expressions In Java (2) (3) (4)

(1) (Reply)

Method Chaining In Java by skptricks: 6:54am On Aug 27, 2018
Post Link : https://www.skptricks.com/2018/08/method-chaining-in-java.html


The term method chaining refers to both a design and a convention. Each method returns an object, allowing the calls to be chained together in a single statement. Chaining is syntactic sugar which eliminates the need for intermediate variables. A method chain is also known as a train wreck due to the increase in the number of methods that come one after another in the same line that occurs as more methods are chained together even though line breaks are often added between methods.

It applies to classes and methods where:
multiple methods are potentially going to be called on the same object;
the methods in question need no return value.
The idea of method chaining is that if the methods need no "useful" return value, then the method can return this

(1) (Reply)

Let's Know Who Is A Programmer With This / Bitcoin Gurus,pls Enlighten Me Want To Start Trading. / Admob Ad Not Converting. Interestial Ad Not Displaying. Any Help?

(Go Up)

Sections: politics (1) business autos (1) jobs (1) career education (1) romance computers phones travel sports fashion health
religion celebs tv-movies music-radio literature webmasters programming techmarket

Links: (1) (2) (3) (4) (5) (6) (7) (8) (9) (10)

Nairaland - Copyright © 2005 - 2024 Oluwaseun Osewa. All rights reserved. See How To Advertise. 7
Disclaimer: Every Nairaland member is solely responsible for anything that he/she posts or uploads on Nairaland.