Say if I have a user input any word they want and I want to save that word to an Array named the first letter of the word they enter. I already initialize these Arrays ( a - z ). So when a user enters for example:
"Apple" and gets saved as word, then I do .substring(0,1).toLowerCase(); and save that as String Letter. How do I go about basically doing Letter.add(word);
At the moment I have 26 if statements and there MUST be an easier way of doing this.
Thank you.
Edit: What I have now is an ArrayList of ArrayLists because it was what our teacher wanted. I called the first Array List, and then the Arrays inside that are named a - z. In one of my methods I want to delete an entry by name. deleteEntry ( String name ). I then get the first letter of that name and put it to lowercase. Then I dont know how I can just do [firstLetter].remove(x) (where x is index of name)
Basically is it possible to do this.
(String).add(Another String);
where the String can only be a letter of the english alphabet.