I want to take each Twitter status and split them into individual words and store them in an ArrayList called terms. I'm trying to use the split() method as I've been told that split() can help me separate a String sentence into individual words nicely into an array, but I seem to be running into an error (IndexOutOfBoundsException) and I'm not sure why, because I can't seem to find the source of error/error line from the Run I/O.
private List<Status> statuses;
private List<String> terms;
public void splitIntoWords()
{
for (Status thisStatus: statuses)
{
String temp = thisStatus.getText();
System.out.println(temp);
String[] arr = temp.split(" ");
for(int i = 0; i<arr.length; i++)
{
terms.add(arr[i]);
}
}
}