Advertisement
Guest User

Untitled

a guest
Apr 2nd, 2020
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.15 KB | None | 0 0
  1. public static ArrayList<String> NOTOperator(String[] cuv1,String[]cuv2, ArrayList<String> list)
  2. {
  3. ArrayList<String> documentsList=new ArrayList<String>();
  4. if(list.size()==0)
  5. {
  6. if(cuv1 !=null)
  7. {
  8. for(int i=0;i<cuv1.length;i++)
  9. {
  10. if(!cuv1[i].equals(""))
  11. {
  12. if(verifyIfTermenExists(documentsList, cuv1[i])==false)
  13. {
  14. documentsList.add(cuv1[i]);
  15. }
  16. }
  17. }
  18. }
  19. if(cuv2!=null)
  20. {
  21. for(int i=0;i<documentsList.size();i++)
  22. {
  23. for(int j=0;j<cuv2.length;j++)
  24. {
  25. if(documentsList.get(i).equals(cuv2[j]))
  26. {
  27. documentsList.remove(i);
  28. continue;
  29. }
  30. }
  31. }
  32. }
  33. return documentsList;
  34. }
  35. else
  36. {
  37. for(int i=0;i<list.size();i++)
  38. {
  39. for(int j=1;j<cuv2.length;j++)
  40. {
  41. if(list.get(i).equals(cuv2[j])) {
  42. list.remove(i);
  43. }
  44. }
  45. }
  46. return list;
  47. }
  48. }
  49.  
  50. public static boolean verifyIfTermenExists(ArrayList<String>documentsList,String values)
  51. {
  52. for(int i=0;i<documentsList.size();i++)
  53. {
  54. if(documentsList.get(i).equals(values))
  55. {
  56. return true;
  57. }
  58. }
  59. return false;
  60. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement