title: How to check if a string contains all the letters of the alphabet?
body: <p>I am trying to check if a string contains all the letters of the alphabet. I created an <code>ArrayList</code> which contains the whole alphabet. I converted the string to char array and I'm iterating through the character array, and for every character present in the <code>ArrayList</code> I'm removing an element from it. And in the end, I'm trying to check if the <code>Arraylist</code> is empty to see if all elements have been removed. That would indicate the string contains all the letters of the alphabet. </p>
  
  <p>Unfortunately, the code is throwing <code>IndexOutOfBoundsException</code> error inside the if condition where I'm removing elements from the arraylist</p>
  
  <pre><code>List&lt;Character&gt; alphabets = new ArrayList&lt;Character&gt;();
  
  alphabets.add('a');
  alphabets.add('b');
  alphabets.add('c');
  alphabets.add('d');
  alphabets.add('e');
  alphabets.add('f');
  alphabets.add('g');
  alphabets.add('h');
  alphabets.add('i');
  alphabets.add('j');
  alphabets.add('k');
  alphabets.add('l');
  alphabets.add('m');
  alphabets.add('n');
  alphabets.add('o');
  alphabets.add('p');
  alphabets.add('q');
  alphabets.add('r');
  alphabets.add('s');
  alphabets.add('t');
  alphabets.add('u');
  alphabets.add('v');
  alphabets.add('w');
  alphabets.add('x');
  alphabets.add('y');
  alphabets.add('z');
  
  // This is the string- I've just put a random example
  String str = "a dog is running crazily on the ground who doesn't care about the world";
  
  //Remove all the spaces
  str = str.replace(" ", "");
  
  // Convert the string to character array
  char[] strChar = str.toCharArray();
  
  for (int i = 0; i &lt; strChar.length; i++) {
  
      char inp = strChar[i];
  
      if (alphabets.contains(inp)) {
          alphabets.remove(inp);
      }
  }
  
  if (alphabets.isEmpty())
      System.out.println("String contains all alphabets");
  else
      System.out.println("String DOESN'T contains all alphabets");
  </code></pre>