title: Is Java application performance dependent on passing of variables to method?
body: <p><br>
  Maybe this is trivial question for experienced programmers but i wonder if there is any significant performance difference (with big or very big amount of data in collection) between two difference approaches of passing variables?<br>
  I've made a tests but with rather small data structures and i don't see any significant differences. Additionally i am not sure if these differences aren't caused by interferences from other applications run in background.<br></p>
  
  <p>Class with collection:</p>
  
  <pre><code>public class TestCollection
  {
      ArrayList&lt;String[]&gt; myTestCollection = new ArrayList&lt;String[]&gt;();
      public TestCollection()
      {
        fillCollection();
      }
  
      private void fillCollection()
      {
          // here is fillng with big amount of data
      }
  
      public ArrayList&lt;String[]&gt; getI()
      {
          return myTestCollection;
      }
  }
  </code></pre>
  
  <p>And methods that operate on collection:</p>
  
  <pre><code>public class Test
  {
      static TestCollection tc = new TestCollection();
  
      public static void main(String[] args)
      {
          new Test().approach_1(tc);
          new Test().approach_2(tc.getI());
      }
  
      public void approach_1(TestCollection t)
      {
          for (int i = 0; i &lt; tc.getI().size(); i++)
          {
              // some actions with collection using tc.getI().DOSOMETHING
          }
      }
  
      public void approach_2(ArrayList&lt;String[]&gt; t)
      {
          for (int i = 0; i &lt; t.size(); i++)
          {
              // some actions with collection using t.DOSOMETHING
          }
      }
  }
  </code></pre>
  
  <p>Regards.</p>