title: Error: The method add(java.lang.String) is undefined for the type java.lang.Object
body: <p>Don't know why I'm getting this error. Working with ArrayLists and sorting words into appropriate ArrayLists by alphabetical order. If anyone can help me understand why I'm getting the error and how to fix it that would be great!</p>
  
  <pre><code>import java.util.*;
  
  public class Sort {
      public static ArrayList&lt;Object&gt; sortByFirstLetter( List&lt;String&gt; words) {
          ArrayList&lt;Object&gt; bucket = new ArrayList&lt;Object&gt;();
          for( int i = 0; i &lt; 26; i++ ) {
              ArrayList&lt;String&gt; letter = new ArrayList&lt;String&gt;();
              bucket.add(letter);
          }
          for( String word : words ) {
              int index = (int)(word.toLowerCase().charAt(0)) - 97; //get a number 0-25 for index; 97 is unicode for lwrcse "a"
              System.out.println(index);
              bucket.get(index).add(str);     //THIS LINE GIVES ERROR
          }
          return bucket;
      }
  
      public static void main(String[] args) {   
          List&lt;String&gt; words = Arrays.asList("alex", "andy", "kevin");
          sortByFirstLetter( words );
      }
  </code></pre>
  
  <p>}</p>