₦airaland Forum

Welcome, Guest: Register • Login • With Google • Trending • Recent • New

Stats: 3,344,221 members, 8,510,748 topics. Date: Friday, 30 October 2026 at 11:50 PM

Toggle theme

Method Chaining In Java - Programming - Nairaland

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

1 Reply

Method Chaining In Java by skptricks(op): 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

Pro JS Devs, Please Is This Variable Chaining • Question On Regular Expressions In Java • Network Programming In Java (UDP And TCP) • 2 • 3 • 4

Vacancy - Front-end Developer • We Are Giving Out 15 Web Development Ebooks For Free • Source Code For Sale