title: Passing ArrayList reference to another class
body: <p>I understood that Objects are passed as references in Java.
  So, Is it <strong>correct</strong> to do like this? ArrayList is created in parent procedure, then passed to procedure in another class for creating new set of elements in it.</p>
  
  <pre><code>class DO_Thing {
   private static ArrayList&lt;ElementClass&gt; fr = new ArrayList&lt;&gt;();
  
   public static void do_main() {
      fr= Functions.add_elements(fr);
   }
  }
  
  public class Functions {
       public static ArrayList&lt;ElementClass&gt; add_elements(ArrayList&lt;ElementClass &gt; frk) {
          ElementClass ier;
          ResultSet zuzis;
          frk.clear();
          zuzis = dbini.db_getallrow("frakcijas");
          try {
              while (zuzis.next()) {
                  ier = new Frakcijas();
                  ier.frid = zuzis.getInt("frakcijas_id");
                  ier.frnos = zuzis.getString("nosaukums");
                  frk.add(ier);
              }
          } catch (SQLException a) {
              System.out.println(a);
          }
          return frk;
      }
  }
  </code></pre>