title: How to use a loop in a toString?
body: <p>I need to print the name of the shop  (this method is in the Shop class) as well as the product name (which is an arraylist) and the price of the product ( which is done using a getter from the class Product). I want to loop through all the products in the arraylist, how can I do that ? </p>
  
  <p>Please if something is not clear comment it and I will edit the question to make it clearer.</p>
  
  <pre><code>public String toString()
  {
  
      for(int i=0; i&lt;products.size();i++)
      {
          return "Shop"+"["+"name"+" = "+name+","+"Product name"+" = "+products.get(i).getName()+", "+"Price"+" = "+products.get(i).getPrice()+"]";
      }
  
      return null;                    
  
  }
  </code></pre>
  
  <p>This is wrong as the i++ is a dead code which means that the loop will execute once. Any help please ?
  Thanks for your time</p>