java - Difference between method chaining and fluent interface -


i wanted know exact difference between method chaining , fluent interface. understand it, method chaining running methods of previous method return objects while avoiding temporary variables. example of

integer.parseint(str).intvalue() 

with respect fluent interface, each method of object chained point, without having related previous method 2 techniques make modifiers methods return host objects, multiple modifiers can invoked in single expression this:

new car().startsengine().openwindow() 

is correct?

i don't think there's major difference; or rather, 2 concepts @ different layers. method chaining simple thing call method directly on return value of different method.

a fluent interface style of designing api multiple-step, complex operation reads close prose. fluent interface meant used through method chaining. can use same mutable object every call, or can return new immutable object every time, depending on interface author thinks idea.


Comments

Popular posts from this blog

python - Selenium remoteWebDriver (& SauceLabs) Firefox moseMoveTo action exception -

html - How to custom Bootstrap grid height? -

transpose - Maple isnt executing function but prints function term -