Is there a way that I can compare an array and an arraylist like
if (array[0]==arraylist[0])
I am working on this problem:
String[] s= {"a","a","b","b","b","c"};
ArrayList<String> list = new ArrayList<String>();
list.add("a");
list.add("b");
list.add("c");
// create a new arraylist that stores the frequency of each character.
// For example, "a" appears twice in s, so newArrayList[0]=2; "b" appears
// three times, so newArrayList[1]=3, and so on.
My idea is using a loop to scan through the string array and every time when a letter in it equals the letter in list, int count++. But I dont know how to compare things in an array and things in an arraylist.