title: Removing stopwords from a String in Java
body: <p>I have a string with lots of words and I have a text file which contains some Stopwords which I need to remove from my String. 
  Let's say I have a String </p>
  
  <pre><code>s="I love this phone, its super fast and there's so much new and cool things with jelly bean....but of recently I've seen some bugs."
  </code></pre>
  
  <p>After removing stopwords, string should be like :</p>
  
  <pre><code>"love phone, super fast much cool jelly bean....but recently bugs."
  </code></pre>
  
  <p>I have been able to achieve this but the problem I am facing is that whenver there are adjacent stopwords in the String its removing only the first and I am getting result as :</p>
  
  <pre><code>"love phone, super fast there's much and cool with jelly bean....but recently seen bugs"  
  </code></pre>
  
  <p>Here's my stopwordslist.txt file :
      <a href="https://www.dropbox.com/s/hcd0fw8i6uwfnkr/stopwordslist.txt?dl=0" rel="noreferrer">Stopwords</a></p>
  
  <p>How can I solve this problem. Here's what I have done so far :</p>
  
  <pre><code>int k=0,i,j;
  ArrayList&lt;String&gt; wordsList = new ArrayList&lt;String&gt;();
  String sCurrentLine;
  String[] stopwords = new String[2000];
  try{
          FileReader fr=new FileReader("F:\\stopwordslist.txt");
          BufferedReader br= new BufferedReader(fr);
          while ((sCurrentLine = br.readLine()) != null){
              stopwords[k]=sCurrentLine;
              k++;
          }
          String s="I love this phone, its super fast and there's so much new and cool things with jelly bean....but of recently I've seen some bugs.";
          StringBuilder builder = new StringBuilder(s);
          String[] words = builder.toString().split("\\s");
          for (String word : words){
              wordsList.add(word);
          }
          for(int ii = 0; ii &lt; wordsList.size(); ii++){
              for(int jj = 0; jj &lt; k; jj++){
                  if(stopwords[jj].contains(wordsList.get(ii).toLowerCase())){
                      wordsList.remove(ii);
                      break;
                  }
               }
          }
          for (String str : wordsList){
              System.out.print(str+" ");
          }   
      }catch(Exception ex){
          System.out.println(ex);
      }
  </code></pre>