Pass By ReferencePass by reference or by value?JSON and escaped double quoteApex Test not updating parent object field based on child object formula fieldsAssistance with a Test Class to increase code coverageApex: pass variable by referenceschema.getglobaldescribe needs test classHow to pass a variable's value of child visualforce page to a variable in parent visualforce using jsCode Coverage to Test Custom Object Public ListCannot Return a List of Strings - Void method must not return a valuePass By Reference VS Pass by Value

Is there a public standard for 8 and 10 character grid locators?

Why are C64 games inconsistent with which joystick port they use?

How to make a crossed out leftrightarrow?

What do different value notes on the same line mean?

Crossing US border with music files I'm legally allowed to possess

How were these pictures of spacecraft wind tunnel testing taken?

Full horizontal justification in table

Is the first derivative operation on a signal a causal system?

What is the object moving across the ceiling in this stock footage?

Rotation period of a planet around a star (sun)

Seed ship, unsexed person, cover has golden person attached to ship by umbilical cord

How do you say “buy” in the sense of “believe”?

What is the difference between “/private/var/vm” and “/vm”?

Were pens caps holes designed to prevent death by suffocation if swallowed?

When and what was the first 3D acceleration device ever released?

Under what law can the U.S. arrest International Criminal Court (ICC) judges over war crimes probe?

What is the most important source of natural gas? coal, oil or other?

Rename photos to match video titles

Forward and backward integration -- cause of errors

How does an ARM MCU run faster than the external crystal?

Does this degree 12 genus 1 curve have only one point over infinitely many finite fields?

analysis of BJT PNP type - why they can use voltage divider?

How many chess players are over 2500 Elo?

Infinite Sequence based on Simple Rule



Pass By Reference


Pass by reference or by value?JSON and escaped double quoteApex Test not updating parent object field based on child object formula fieldsAssistance with a Test Class to increase code coverageApex: pass variable by referenceschema.getglobaldescribe needs test classHow to pass a variable's value of child visualforce page to a variable in parent visualforce using jsCode Coverage to Test Custom Object Public ListCannot Return a List of Strings - Void method must not return a valuePass By Reference VS Pass by Value






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








3















This is a more general computer science question -hope those are ok to ask here.
As a self-taught Salesforce dev I have been trying to work on my core computer science knowledge. I am working on pointers and passing by reference vs value right now.



In the documentation, it says that all primitive values are passed by value. I wrote the following trivial program below to swap integer values and it behaves exactly as I would expect. Inside the function, the values change but the values for the original Integer x and y do not.



Is there a way in Apex to change the value of the original variable? The way you can use an int * in C?



public with sharing class Swapper 

public static void swapInteger(Integer x, Integer y)
Integer tempInteger = x;
x = y;
y = tempInteger;

System.debug('value of x in function ' + x);
System.debug('value of y in function ' + y);




test class



@IsTest
private class Swapper_Test
@IsTest
static void swapTest()
Integer x = 5;
Integer y = 10;
Swapper.swapInteger(x , y);

System.assertEquals(5, y);
System.assertEquals(10, x);











share|improve this question






























    3















    This is a more general computer science question -hope those are ok to ask here.
    As a self-taught Salesforce dev I have been trying to work on my core computer science knowledge. I am working on pointers and passing by reference vs value right now.



    In the documentation, it says that all primitive values are passed by value. I wrote the following trivial program below to swap integer values and it behaves exactly as I would expect. Inside the function, the values change but the values for the original Integer x and y do not.



    Is there a way in Apex to change the value of the original variable? The way you can use an int * in C?



    public with sharing class Swapper 

    public static void swapInteger(Integer x, Integer y)
    Integer tempInteger = x;
    x = y;
    y = tempInteger;

    System.debug('value of x in function ' + x);
    System.debug('value of y in function ' + y);




    test class



    @IsTest
    private class Swapper_Test
    @IsTest
    static void swapTest()
    Integer x = 5;
    Integer y = 10;
    Swapper.swapInteger(x , y);

    System.assertEquals(5, y);
    System.assertEquals(10, x);











    share|improve this question


























      3












      3








      3








      This is a more general computer science question -hope those are ok to ask here.
      As a self-taught Salesforce dev I have been trying to work on my core computer science knowledge. I am working on pointers and passing by reference vs value right now.



      In the documentation, it says that all primitive values are passed by value. I wrote the following trivial program below to swap integer values and it behaves exactly as I would expect. Inside the function, the values change but the values for the original Integer x and y do not.



      Is there a way in Apex to change the value of the original variable? The way you can use an int * in C?



      public with sharing class Swapper 

      public static void swapInteger(Integer x, Integer y)
      Integer tempInteger = x;
      x = y;
      y = tempInteger;

      System.debug('value of x in function ' + x);
      System.debug('value of y in function ' + y);




      test class



      @IsTest
      private class Swapper_Test
      @IsTest
      static void swapTest()
      Integer x = 5;
      Integer y = 10;
      Swapper.swapInteger(x , y);

      System.assertEquals(5, y);
      System.assertEquals(10, x);











      share|improve this question
















      This is a more general computer science question -hope those are ok to ask here.
      As a self-taught Salesforce dev I have been trying to work on my core computer science knowledge. I am working on pointers and passing by reference vs value right now.



      In the documentation, it says that all primitive values are passed by value. I wrote the following trivial program below to swap integer values and it behaves exactly as I would expect. Inside the function, the values change but the values for the original Integer x and y do not.



      Is there a way in Apex to change the value of the original variable? The way you can use an int * in C?



      public with sharing class Swapper 

      public static void swapInteger(Integer x, Integer y)
      Integer tempInteger = x;
      x = y;
      y = tempInteger;

      System.debug('value of x in function ' + x);
      System.debug('value of y in function ' + y);




      test class



      @IsTest
      private class Swapper_Test
      @IsTest
      static void swapTest()
      Integer x = 5;
      Integer y = 10;
      Swapper.swapInteger(x , y);

      System.assertEquals(5, y);
      System.assertEquals(10, x);








      apex






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited May 14 at 11:45









      David Reed

      43.3k82564




      43.3k82564










      asked May 14 at 11:43









      Brooks JohnsonBrooks Johnson

      323110




      323110




















          3 Answers
          3






          active

          oldest

          votes


















          3














          In Apex, everything is pass-by-value, and all variables only store references. You might say that parameters are passed by reference-value. This is different than some other languages, where you might pass by reference or by value, and it kind of muddies the waters a bit.



          The value of each variable is copied when provided as a parameter, but since Apex only uses references, what you get is a copy of a reference; if the object is not immutable, it can be modified to a new value. The original variable that held the reference, however, cannot be modified by the callee (which is what is typically meant by passing by reference).



          All you really need to know is that there's no way to get a reference to a variable directly, you can only get references to objects on the heap. There is no way to write this type of code in Apex without using an object of some sort:



          class TwoValues 
          Integer x, y;

          public void swapTwoValues(TwoValues items)
          Integer temp = items.y;
          items.y = items.x;
          items.x = temp;

          ...
          TwoItems item = new TwoItems();
          item.x = 5;
          item.y = 10;
          swapTwoValues(item);





          share|improve this answer






























            3














            As far as i understand salesforce is based on Java or at least follows the concepts of JAVA and java supports Pass by value.



            2nd point is that pass by reference is a complex concept whole concept of salesforce is to focus on less coding means less developer skills so it is not feasible to provide such difficult features.



            3rd point is that you are always allowed to create public variable or class level variables which you can access in different methods, hence no need of passing by reference.






            share|improve this answer






























              1














              A very good example of this topic is provided on the Passing Parameters By Reference and By Value in Apex documentation. Everything in Apex is passed-by-value. The docs mentions as below (emphasis mine):




              As described in the new developer’s guide text, Apex is not passing anything by reference. It is passing the reference (i.e., the memory address) by value, which allows the developer to change fields on the object and call methods (like list.add()) on the object




              The doc contains example around this.



              As an example, in the below class, the two methods reflect this behavior.



              public class PassByExample 

              /**
              * this change in the passed list will be always known to the caller
              * the memory address was passed-by-value
              * the caller will always have the original memory address and thus the values
              */
              public static void passByValueChange(List<String> lstString)
              lstString.add('This was added in the method');


              /**
              * this change in the passed list will be NOT known to the caller
              * the memory address was passed-by-value; but changed in the method
              * the caller will always have the original memory address and NOT the new one
              */
              public static void passByValueNoChange(List<String> lstString)
              lstString = new List<String>(); // memory address was changed
              lstString.add('This was additionally added in the method');




              Now, when you test this out:



              @isTest static void testPassByValueChange() 
              List<String> lst = new List<String>();
              lst.add('Added from test class');

              PassByExample.passByValueChange(lst);
              system.debug(lst); // debugs (Added from test class, This was added in the method)
              system.assertEquals(2, lst.size());


              @isTest static void testPassByValueNoChange()
              List<String> lst = new List<String>();
              lst.add('Added from test class');

              PassByExample.passByValueNoChange(lst);
              system.debug(lst); // debugs (Added from test class)
              system.assertEquals(1, lst.size());






              share|improve this answer

























              • passByValueNoChange should only show "Added from test class" and size should be 1.

                – sfdcfox
                May 14 at 16:57











              • That was a copy paste mistake. And for the size, the snippet was run from the same test method, thus 2.

                – Jayant Das
                May 14 at 16:59











              • Fair enough, though the example might cause some confusion. Perhaps make it something a bit more obvious?

                – sfdcfox
                May 14 at 17:01











              • Fair point. Updated to reflect different test methods now.

                – Jayant Das
                May 14 at 17:05











              Your Answer








              StackExchange.ready(function()
              var channelOptions =
              tags: "".split(" "),
              id: "459"
              ;
              initTagRenderer("".split(" "), "".split(" "), channelOptions);

              StackExchange.using("externalEditor", function()
              // Have to fire editor after snippets, if snippets enabled
              if (StackExchange.settings.snippets.snippetsEnabled)
              StackExchange.using("snippets", function()
              createEditor();
              );

              else
              createEditor();

              );

              function createEditor()
              StackExchange.prepareEditor(
              heartbeatType: 'answer',
              autoActivateHeartbeat: false,
              convertImagesToLinks: false,
              noModals: true,
              showLowRepImageUploadWarning: true,
              reputationToPostImages: null,
              bindNavPrevention: true,
              postfix: "",
              imageUploader:
              brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
              contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
              allowUrls: true
              ,
              onDemand: true,
              discardSelector: ".discard-answer"
              ,immediatelyShowMarkdownHelp:true
              );



              );













              draft saved

              draft discarded


















              StackExchange.ready(
              function ()
              StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsalesforce.stackexchange.com%2fquestions%2f262312%2fpass-by-reference%23new-answer', 'question_page');

              );

              Post as a guest















              Required, but never shown

























              3 Answers
              3






              active

              oldest

              votes








              3 Answers
              3






              active

              oldest

              votes









              active

              oldest

              votes






              active

              oldest

              votes









              3














              In Apex, everything is pass-by-value, and all variables only store references. You might say that parameters are passed by reference-value. This is different than some other languages, where you might pass by reference or by value, and it kind of muddies the waters a bit.



              The value of each variable is copied when provided as a parameter, but since Apex only uses references, what you get is a copy of a reference; if the object is not immutable, it can be modified to a new value. The original variable that held the reference, however, cannot be modified by the callee (which is what is typically meant by passing by reference).



              All you really need to know is that there's no way to get a reference to a variable directly, you can only get references to objects on the heap. There is no way to write this type of code in Apex without using an object of some sort:



              class TwoValues 
              Integer x, y;

              public void swapTwoValues(TwoValues items)
              Integer temp = items.y;
              items.y = items.x;
              items.x = temp;

              ...
              TwoItems item = new TwoItems();
              item.x = 5;
              item.y = 10;
              swapTwoValues(item);





              share|improve this answer



























                3














                In Apex, everything is pass-by-value, and all variables only store references. You might say that parameters are passed by reference-value. This is different than some other languages, where you might pass by reference or by value, and it kind of muddies the waters a bit.



                The value of each variable is copied when provided as a parameter, but since Apex only uses references, what you get is a copy of a reference; if the object is not immutable, it can be modified to a new value. The original variable that held the reference, however, cannot be modified by the callee (which is what is typically meant by passing by reference).



                All you really need to know is that there's no way to get a reference to a variable directly, you can only get references to objects on the heap. There is no way to write this type of code in Apex without using an object of some sort:



                class TwoValues 
                Integer x, y;

                public void swapTwoValues(TwoValues items)
                Integer temp = items.y;
                items.y = items.x;
                items.x = temp;

                ...
                TwoItems item = new TwoItems();
                item.x = 5;
                item.y = 10;
                swapTwoValues(item);





                share|improve this answer

























                  3












                  3








                  3







                  In Apex, everything is pass-by-value, and all variables only store references. You might say that parameters are passed by reference-value. This is different than some other languages, where you might pass by reference or by value, and it kind of muddies the waters a bit.



                  The value of each variable is copied when provided as a parameter, but since Apex only uses references, what you get is a copy of a reference; if the object is not immutable, it can be modified to a new value. The original variable that held the reference, however, cannot be modified by the callee (which is what is typically meant by passing by reference).



                  All you really need to know is that there's no way to get a reference to a variable directly, you can only get references to objects on the heap. There is no way to write this type of code in Apex without using an object of some sort:



                  class TwoValues 
                  Integer x, y;

                  public void swapTwoValues(TwoValues items)
                  Integer temp = items.y;
                  items.y = items.x;
                  items.x = temp;

                  ...
                  TwoItems item = new TwoItems();
                  item.x = 5;
                  item.y = 10;
                  swapTwoValues(item);





                  share|improve this answer













                  In Apex, everything is pass-by-value, and all variables only store references. You might say that parameters are passed by reference-value. This is different than some other languages, where you might pass by reference or by value, and it kind of muddies the waters a bit.



                  The value of each variable is copied when provided as a parameter, but since Apex only uses references, what you get is a copy of a reference; if the object is not immutable, it can be modified to a new value. The original variable that held the reference, however, cannot be modified by the callee (which is what is typically meant by passing by reference).



                  All you really need to know is that there's no way to get a reference to a variable directly, you can only get references to objects on the heap. There is no way to write this type of code in Apex without using an object of some sort:



                  class TwoValues 
                  Integer x, y;

                  public void swapTwoValues(TwoValues items)
                  Integer temp = items.y;
                  items.y = items.x;
                  items.x = temp;

                  ...
                  TwoItems item = new TwoItems();
                  item.x = 5;
                  item.y = 10;
                  swapTwoValues(item);






                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered May 14 at 12:21









                  sfdcfoxsfdcfox

                  271k13220472




                  271k13220472























                      3














                      As far as i understand salesforce is based on Java or at least follows the concepts of JAVA and java supports Pass by value.



                      2nd point is that pass by reference is a complex concept whole concept of salesforce is to focus on less coding means less developer skills so it is not feasible to provide such difficult features.



                      3rd point is that you are always allowed to create public variable or class level variables which you can access in different methods, hence no need of passing by reference.






                      share|improve this answer



























                        3














                        As far as i understand salesforce is based on Java or at least follows the concepts of JAVA and java supports Pass by value.



                        2nd point is that pass by reference is a complex concept whole concept of salesforce is to focus on less coding means less developer skills so it is not feasible to provide such difficult features.



                        3rd point is that you are always allowed to create public variable or class level variables which you can access in different methods, hence no need of passing by reference.






                        share|improve this answer

























                          3












                          3








                          3







                          As far as i understand salesforce is based on Java or at least follows the concepts of JAVA and java supports Pass by value.



                          2nd point is that pass by reference is a complex concept whole concept of salesforce is to focus on less coding means less developer skills so it is not feasible to provide such difficult features.



                          3rd point is that you are always allowed to create public variable or class level variables which you can access in different methods, hence no need of passing by reference.






                          share|improve this answer













                          As far as i understand salesforce is based on Java or at least follows the concepts of JAVA and java supports Pass by value.



                          2nd point is that pass by reference is a complex concept whole concept of salesforce is to focus on less coding means less developer skills so it is not feasible to provide such difficult features.



                          3rd point is that you are always allowed to create public variable or class level variables which you can access in different methods, hence no need of passing by reference.







                          share|improve this answer












                          share|improve this answer



                          share|improve this answer










                          answered May 14 at 12:06









                          Mr.FrodoMr.Frodo

                          5,20311231




                          5,20311231





















                              1














                              A very good example of this topic is provided on the Passing Parameters By Reference and By Value in Apex documentation. Everything in Apex is passed-by-value. The docs mentions as below (emphasis mine):




                              As described in the new developer’s guide text, Apex is not passing anything by reference. It is passing the reference (i.e., the memory address) by value, which allows the developer to change fields on the object and call methods (like list.add()) on the object




                              The doc contains example around this.



                              As an example, in the below class, the two methods reflect this behavior.



                              public class PassByExample 

                              /**
                              * this change in the passed list will be always known to the caller
                              * the memory address was passed-by-value
                              * the caller will always have the original memory address and thus the values
                              */
                              public static void passByValueChange(List<String> lstString)
                              lstString.add('This was added in the method');


                              /**
                              * this change in the passed list will be NOT known to the caller
                              * the memory address was passed-by-value; but changed in the method
                              * the caller will always have the original memory address and NOT the new one
                              */
                              public static void passByValueNoChange(List<String> lstString)
                              lstString = new List<String>(); // memory address was changed
                              lstString.add('This was additionally added in the method');




                              Now, when you test this out:



                              @isTest static void testPassByValueChange() 
                              List<String> lst = new List<String>();
                              lst.add('Added from test class');

                              PassByExample.passByValueChange(lst);
                              system.debug(lst); // debugs (Added from test class, This was added in the method)
                              system.assertEquals(2, lst.size());


                              @isTest static void testPassByValueNoChange()
                              List<String> lst = new List<String>();
                              lst.add('Added from test class');

                              PassByExample.passByValueNoChange(lst);
                              system.debug(lst); // debugs (Added from test class)
                              system.assertEquals(1, lst.size());






                              share|improve this answer

























                              • passByValueNoChange should only show "Added from test class" and size should be 1.

                                – sfdcfox
                                May 14 at 16:57











                              • That was a copy paste mistake. And for the size, the snippet was run from the same test method, thus 2.

                                – Jayant Das
                                May 14 at 16:59











                              • Fair enough, though the example might cause some confusion. Perhaps make it something a bit more obvious?

                                – sfdcfox
                                May 14 at 17:01











                              • Fair point. Updated to reflect different test methods now.

                                – Jayant Das
                                May 14 at 17:05















                              1














                              A very good example of this topic is provided on the Passing Parameters By Reference and By Value in Apex documentation. Everything in Apex is passed-by-value. The docs mentions as below (emphasis mine):




                              As described in the new developer’s guide text, Apex is not passing anything by reference. It is passing the reference (i.e., the memory address) by value, which allows the developer to change fields on the object and call methods (like list.add()) on the object




                              The doc contains example around this.



                              As an example, in the below class, the two methods reflect this behavior.



                              public class PassByExample 

                              /**
                              * this change in the passed list will be always known to the caller
                              * the memory address was passed-by-value
                              * the caller will always have the original memory address and thus the values
                              */
                              public static void passByValueChange(List<String> lstString)
                              lstString.add('This was added in the method');


                              /**
                              * this change in the passed list will be NOT known to the caller
                              * the memory address was passed-by-value; but changed in the method
                              * the caller will always have the original memory address and NOT the new one
                              */
                              public static void passByValueNoChange(List<String> lstString)
                              lstString = new List<String>(); // memory address was changed
                              lstString.add('This was additionally added in the method');




                              Now, when you test this out:



                              @isTest static void testPassByValueChange() 
                              List<String> lst = new List<String>();
                              lst.add('Added from test class');

                              PassByExample.passByValueChange(lst);
                              system.debug(lst); // debugs (Added from test class, This was added in the method)
                              system.assertEquals(2, lst.size());


                              @isTest static void testPassByValueNoChange()
                              List<String> lst = new List<String>();
                              lst.add('Added from test class');

                              PassByExample.passByValueNoChange(lst);
                              system.debug(lst); // debugs (Added from test class)
                              system.assertEquals(1, lst.size());






                              share|improve this answer

























                              • passByValueNoChange should only show "Added from test class" and size should be 1.

                                – sfdcfox
                                May 14 at 16:57











                              • That was a copy paste mistake. And for the size, the snippet was run from the same test method, thus 2.

                                – Jayant Das
                                May 14 at 16:59











                              • Fair enough, though the example might cause some confusion. Perhaps make it something a bit more obvious?

                                – sfdcfox
                                May 14 at 17:01











                              • Fair point. Updated to reflect different test methods now.

                                – Jayant Das
                                May 14 at 17:05













                              1












                              1








                              1







                              A very good example of this topic is provided on the Passing Parameters By Reference and By Value in Apex documentation. Everything in Apex is passed-by-value. The docs mentions as below (emphasis mine):




                              As described in the new developer’s guide text, Apex is not passing anything by reference. It is passing the reference (i.e., the memory address) by value, which allows the developer to change fields on the object and call methods (like list.add()) on the object




                              The doc contains example around this.



                              As an example, in the below class, the two methods reflect this behavior.



                              public class PassByExample 

                              /**
                              * this change in the passed list will be always known to the caller
                              * the memory address was passed-by-value
                              * the caller will always have the original memory address and thus the values
                              */
                              public static void passByValueChange(List<String> lstString)
                              lstString.add('This was added in the method');


                              /**
                              * this change in the passed list will be NOT known to the caller
                              * the memory address was passed-by-value; but changed in the method
                              * the caller will always have the original memory address and NOT the new one
                              */
                              public static void passByValueNoChange(List<String> lstString)
                              lstString = new List<String>(); // memory address was changed
                              lstString.add('This was additionally added in the method');




                              Now, when you test this out:



                              @isTest static void testPassByValueChange() 
                              List<String> lst = new List<String>();
                              lst.add('Added from test class');

                              PassByExample.passByValueChange(lst);
                              system.debug(lst); // debugs (Added from test class, This was added in the method)
                              system.assertEquals(2, lst.size());


                              @isTest static void testPassByValueNoChange()
                              List<String> lst = new List<String>();
                              lst.add('Added from test class');

                              PassByExample.passByValueNoChange(lst);
                              system.debug(lst); // debugs (Added from test class)
                              system.assertEquals(1, lst.size());






                              share|improve this answer















                              A very good example of this topic is provided on the Passing Parameters By Reference and By Value in Apex documentation. Everything in Apex is passed-by-value. The docs mentions as below (emphasis mine):




                              As described in the new developer’s guide text, Apex is not passing anything by reference. It is passing the reference (i.e., the memory address) by value, which allows the developer to change fields on the object and call methods (like list.add()) on the object




                              The doc contains example around this.



                              As an example, in the below class, the two methods reflect this behavior.



                              public class PassByExample 

                              /**
                              * this change in the passed list will be always known to the caller
                              * the memory address was passed-by-value
                              * the caller will always have the original memory address and thus the values
                              */
                              public static void passByValueChange(List<String> lstString)
                              lstString.add('This was added in the method');


                              /**
                              * this change in the passed list will be NOT known to the caller
                              * the memory address was passed-by-value; but changed in the method
                              * the caller will always have the original memory address and NOT the new one
                              */
                              public static void passByValueNoChange(List<String> lstString)
                              lstString = new List<String>(); // memory address was changed
                              lstString.add('This was additionally added in the method');




                              Now, when you test this out:



                              @isTest static void testPassByValueChange() 
                              List<String> lst = new List<String>();
                              lst.add('Added from test class');

                              PassByExample.passByValueChange(lst);
                              system.debug(lst); // debugs (Added from test class, This was added in the method)
                              system.assertEquals(2, lst.size());


                              @isTest static void testPassByValueNoChange()
                              List<String> lst = new List<String>();
                              lst.add('Added from test class');

                              PassByExample.passByValueNoChange(lst);
                              system.debug(lst); // debugs (Added from test class)
                              system.assertEquals(1, lst.size());







                              share|improve this answer














                              share|improve this answer



                              share|improve this answer








                              edited May 14 at 17:05

























                              answered May 14 at 13:00









                              Jayant DasJayant Das

                              21.8k21433




                              21.8k21433












                              • passByValueNoChange should only show "Added from test class" and size should be 1.

                                – sfdcfox
                                May 14 at 16:57











                              • That was a copy paste mistake. And for the size, the snippet was run from the same test method, thus 2.

                                – Jayant Das
                                May 14 at 16:59











                              • Fair enough, though the example might cause some confusion. Perhaps make it something a bit more obvious?

                                – sfdcfox
                                May 14 at 17:01











                              • Fair point. Updated to reflect different test methods now.

                                – Jayant Das
                                May 14 at 17:05

















                              • passByValueNoChange should only show "Added from test class" and size should be 1.

                                – sfdcfox
                                May 14 at 16:57











                              • That was a copy paste mistake. And for the size, the snippet was run from the same test method, thus 2.

                                – Jayant Das
                                May 14 at 16:59











                              • Fair enough, though the example might cause some confusion. Perhaps make it something a bit more obvious?

                                – sfdcfox
                                May 14 at 17:01











                              • Fair point. Updated to reflect different test methods now.

                                – Jayant Das
                                May 14 at 17:05
















                              passByValueNoChange should only show "Added from test class" and size should be 1.

                              – sfdcfox
                              May 14 at 16:57





                              passByValueNoChange should only show "Added from test class" and size should be 1.

                              – sfdcfox
                              May 14 at 16:57













                              That was a copy paste mistake. And for the size, the snippet was run from the same test method, thus 2.

                              – Jayant Das
                              May 14 at 16:59





                              That was a copy paste mistake. And for the size, the snippet was run from the same test method, thus 2.

                              – Jayant Das
                              May 14 at 16:59













                              Fair enough, though the example might cause some confusion. Perhaps make it something a bit more obvious?

                              – sfdcfox
                              May 14 at 17:01





                              Fair enough, though the example might cause some confusion. Perhaps make it something a bit more obvious?

                              – sfdcfox
                              May 14 at 17:01













                              Fair point. Updated to reflect different test methods now.

                              – Jayant Das
                              May 14 at 17:05





                              Fair point. Updated to reflect different test methods now.

                              – Jayant Das
                              May 14 at 17:05

















                              draft saved

                              draft discarded
















































                              Thanks for contributing an answer to Salesforce Stack Exchange!


                              • Please be sure to answer the question. Provide details and share your research!

                              But avoid


                              • Asking for help, clarification, or responding to other answers.

                              • Making statements based on opinion; back them up with references or personal experience.

                              To learn more, see our tips on writing great answers.




                              draft saved


                              draft discarded














                              StackExchange.ready(
                              function ()
                              StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsalesforce.stackexchange.com%2fquestions%2f262312%2fpass-by-reference%23new-answer', 'question_page');

                              );

                              Post as a guest















                              Required, but never shown





















































                              Required, but never shown














                              Required, but never shown












                              Required, but never shown







                              Required, but never shown

































                              Required, but never shown














                              Required, but never shown












                              Required, but never shown







                              Required, but never shown







                              Popular posts from this blog

                              Wikipedia:Vital articles Мазмуну Biography - Өмүр баян Philosophy and psychology - Философия жана психология Religion - Дин Social sciences - Коомдук илимдер Language and literature - Тил жана адабият Science - Илим Technology - Технология Arts and recreation - Искусство жана эс алуу History and geography - Тарых жана география Навигация менюсу

                              Bruxelas-Capital Índice Historia | Composición | Situación lingüística | Clima | Cidades irmandadas | Notas | Véxase tamén | Menú de navegacióneO uso das linguas en Bruxelas e a situación do neerlandés"Rexión de Bruxelas Capital"o orixinalSitio da rexiónPáxina de Bruselas no sitio da Oficina de Promoción Turística de Valonia e BruxelasMapa Interactivo da Rexión de Bruxelas-CapitaleeWorldCat332144929079854441105155190212ID28008674080552-90000 0001 0666 3698n94104302ID540940339365017018237

                              What should I write in an apology letter, since I have decided not to join a company after accepting an offer letterShould I keep looking after accepting a job offer?What should I do when I've been verbally told I would get an offer letter, but still haven't gotten one after 4 weeks?Do I accept an offer from a company that I am not likely to join?New job hasn't confirmed starting date and I want to give current employer as much notice as possibleHow should I address my manager in my resignation letter?HR delayed background verification, now jobless as resignedNo email communication after accepting a formal written offer. How should I phrase the call?What should I do if after receiving a verbal offer letter I am informed that my written job offer is put on hold due to some internal issues?Should I inform the current employer that I am about to resign within 1-2 weeks since I have signed the offer letter and waiting for visa?What company will do, if I send their offer letter to another company