fork(1) download
  1. import java.util.*;
  2. import java.lang.*;
  3. import java.io.*;
  4.  
  5.  
  6. class Ideone
  7. {
  8. public static void main (String[] args) throws java.lang.Exception
  9. {
  10. String[] stopwords = { "the", "and" };
  11. String parts = "the and of the";
  12. LinkedList<String> newWordList = new LinkedList<String>(Arrays.asList(parts));
  13.  
  14. for (Iterator<String> iter = newWordList.iterator(); iter.hasNext();) {
  15. String word = iter.next();
  16. for (int i = 0; i < newWordList.size(); i++) {
  17. if (word.equals(stopwords[i])) {
  18. iter.remove();
  19. }
  20. }
  21. }
  22. System.out.println(newWordList.toString());
  23. }
  24. }
Success #stdin #stdout 0.04s 711168KB
stdin
Standard input is empty
stdout
[the and of the]