Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.programmer > #34122

Re: What does keyword 'this' refer to in the following code?

Newsgroups comp.lang.java.programmer
Date 2016-04-13 05:12 -0700
References <2a655d5f-3df0-4bf2-a2bc-4b70406d7ab2@googlegroups.com> <nejr5l$8c9$1@dont-email.me> <0ecdea31-577e-4117-b6f0-c0a9d42bf3f3@googlegroups.com>
Message-ID <b0707fa4-8541-44f1-8af0-fab09e248ce6@googlegroups.com> (permalink)
Subject Re: What does keyword 'this' refer to in the following code?
From Eric Douglas <e.d.programmer@gmail.com>

Show all headers | View raw


On Tuesday, April 12, 2016 at 11:03:47 PM UTC-4, cda...@gmail.com wrote:
> I have another question. What's the significance of map.addMarker().title().snippet().position()?
> 
This code calls methods on the return value, which may be passing back the object you passed in or a new object.  For instance the String class is immutable so it's methods return new objects, ie
myString.substring(0,2).trim()

> Why not just do something like
> map.addMarker()
> map.title()
> map.snippet()
> map.position()
> ?

This just calls multiple methods on a single object instance.  This is the same as the first format, only if each method is returning the object you passed into it.

Back to comp.lang.java.programmer | Previous | Next — Previous in thread | Find similar | Unroll thread


Thread

What does keyword 'this' refer to in the following code? cdalten@gmail.com - 2016-04-11 21:44 -0700
  Re: What does keyword 'this' refer to in the following code? Jukka Lahtinen <jtfjdehf@hotmail.com.invalid> - 2016-04-12 12:16 +0300
  Re: What does keyword 'this' refer to in the following code? Eric Douglas <e.d.programmer@gmail.com> - 2016-04-12 04:57 -0700
    Re: What does keyword 'this' refer to in the following code? cdalten@gmail.com - 2016-04-12 08:28 -0700
      Re: What does keyword 'this' refer to in the following code? Lew <lewbloch@gmail.com> - 2016-04-12 14:03 -0700
        Re: What does keyword 'this' refer to in the following code? cdalten@gmail.com - 2016-04-12 18:23 -0700
          Re: What does keyword 'this' refer to in the following code? Jukka Lahtinen <jtfjdehf@hotmail.com.invalid> - 2016-04-13 11:39 +0300
          Re: What does keyword 'this' refer to in the following code? Eric Douglas <e.d.programmer@gmail.com> - 2016-04-13 05:07 -0700
  Re: What does keyword 'this' refer to in the following code? Jeff Higgins <jeff@invalid.invalid> - 2016-04-12 22:00 +0000
    Re: What does keyword 'this' refer to in the following code? cdalten@gmail.com - 2016-04-12 20:03 -0700
      Re: What does keyword 'this' refer to in the following code? cdalten@gmail.com - 2016-04-12 21:01 -0700
      Re: What does keyword 'this' refer to in the following code? Lars Enderin <lars.enderin@telia.com> - 2016-04-13 10:58 +0200
      Re: What does keyword 'this' refer to in the following code? Eric Douglas <e.d.programmer@gmail.com> - 2016-04-13 05:12 -0700

csiph-web