I know I could go through a for loop like this (see code) and i could also add to the array in the same fashion but is there a quicker way. I don't want to use any other java API as i want to practice array's. Would using a hash function allow me to store my variables quicker and then find a certain word quicker?
edit: The problem is when using 10,000+ words the delay increases larger than 1ms
Thanks :)
int count = 0;
for(int i = 0; i < array.length; i++)
if(array[i].equals(word))
count++;
Whenever your processing 10,000 words you can expect some delays. Depending on what word is set to you might be able to filter a bit better but as far as your code shows that's the best way to do it.