title: Tyring to display all possible topping combinations
body: <ul>
  <li>The exercise:</li>
  </ul>
  
  <p>You’re at the ice cream store trying to decide what kind of ice cream and toppings you want. There are so many choices!</p>
  
  <p>You decide to write a program to help you list out every possible choice.</p>
  
  <p>Write a method</p>
  
  <p>ArrayList getAllChoices(String[] flavors, String[] toppings)
  That takes an array of ice cream flavors and an array of toppings as parameters, and returns an ArrayList holding every possible combination of ice cream and toppings.</p>
  
  <p>Each combination should be represented in the form</p>
  
  <pre><code>"{{flavor}} with {{topping}} on top"
  </code></pre>
  
  <p>Where {{flavor}} is a provided flavor of ice cream, like “chocolate”, and <code>{{topping}} is a provided topping, like “sprinkles”.</code></p>
  
  <p>For example, the method call:</p>
  
  <pre><code>String[] flavors = {"chocolate", "vanilla"};
  String[] toppings = {"sprinkles", "fudge"};
  getAllChoices(flavors, toppings);
  </code></pre>
  
  <p>Should return an ArrayList holding the following Strings:</p>
  
  <pre><code>["chocolate with sprinkles on top", "chocolate with fudge on top", "vanilla with sprinkles on top", "vanilla with fudge on top"]
  </code></pre>
  
  <p>What I have:</p>
  
  <pre><code>public ArrayList&lt;String&gt; getAllChoices(String[] flavors, String[] toppings)
  {
  
  String[] flavors = {"chocolate", "vanilla"};
  String[] toppings = {"sprinkles", "fudge"};
  
  
  for(int i = 0; i &lt; flavors.size(); i ++)
  {
      for(int x = 0; x &lt; toppings.size(); x++)
      {
  
      String flavorss = flavors[i];
      String toppingss = toppings[x];
  
      return (flavorss + " with " + toppingss + " on top");
  
  
  
  
      }
  }   
  
  
  }
  </code></pre>
  
  <p>Not very good at this and not sure why it isn't working. </p>
  
  <p>Edit: Got it using this solution.</p>
  
  <pre><code>public ArrayList&lt;String&gt; getAllChoices(String[] flavors, String[] toppings)
  {
      ArrayList&lt;String&gt; retList = new ArrayList&lt;String&gt;();
  
      for(int i = 0; i &lt; flavors.length; i ++)
      {
          for(int x = 0; x &lt; toppings.length; x++)
          {
  
              String flavorss = flavors[i];
              String toppingss = toppings[x];
  
              // Add to list instead of returning.
              retList.add(flavorss + " with " + toppingss + " on top");
          }
      }
  
      return retList;
  }
  </code></pre>
  
  <p>Thanks for the help!</p>