I am trying to write a method to capitalize the first word of every element in an arraylist. So if the arraylist is:
"mary had a little lamb"
It would need to change every element to:
"Mary Had A Little Lamb"
This is the code, and this is the only way I can get it to compile. Every other way gives me an error that says that it can't convert an object to a String.
public static void capitalize(List<String> words)
{
    String str = "";
    ListIterator iter = words.listIterator();
    while (iter.hasNext())
    {
        str = iter.next() + "";
        str.toUpperCase();
        iter.set();
    }
}
Hope that was clear enough. Thanks
 
    