title: How do you extract mulitiple string values from a function containing arraylists
body: <p>`I wonder if anyone can help me with this problem or advise of a different way to go about it. I am using selenium webdriver, coding with java using testNG framework.</p>
  
  <p>Basically, I have a method that extracts data from excel and stores them as arraylists. So for example, i have</p>
  
  <p>this sort of data:</p>
  
  <pre><code>Region      Text1   Text2   Text3
  UK          uk_t1   uk_t2   uk_t3
  usa         usa_t1  usa_t2  usa_t3
  russ        rus_t1  rus_t2  rus_t3
  </code></pre>
  
  <p>My method extracts all the information from excel and stores it into arraylist based on the column name</p>
  
  <p>Example- </p>
  
  <pre><code>Arraylist&lt;String&gt;region = new ArrayList&lt;String&gt; ();
  Arraylist&lt;String&gt;text1 = new ArrayList&lt;String&gt; ();
  Arraylist&lt;String&gt;text2 = new ArrayList&lt;String&gt; ();
  Arraylist&lt;String&gt;text3 = new ArrayList&lt;String&gt; ();
  
  
  ArrayList&lt;String&gt; mydatacells = dataFromExcel(xlspath) // the method on the right is the one with the excel function
  
  String xlspath = "example/mylocation";
  
  
  int uk = 4; //location of the cell that contains the string uk
  int usa   = 8; //location of the cell that contains the string usa
  int russ = 12; //location of the cell that contains the string russ
  </code></pre>
  
  <p>I then write the following to extract data specifically for a region</p>
  
  <pre><code>for(uk=4; uk&lt;usa; uk++){
  
  region.add(mydatacells.get(uk));
  text1.add(mydatacells.get(uk));
  text2.add(mydatacells.get(uk));
  text3.add(mydatacells.get(uk));
  
  } //the code assigns the value for uk
  </code></pre>
  
  <p>My problem now is that i need to use those values in another method and i need to get all the data.</p>
  
  <p>Does anyone have an idea how this can be done or a more efficient way to do this?</p>
  
  <p>Thanks</p>