title: How do I find a specific string on a bigger string?
body: <p>I am trying to get rid of multiple specific strings. For instance, I have a string that prints:</p>
  
  <p>1.jedi
  2.sith
  3.sith
  4.sith
  5.bounty hunter
  6.jedi
  7.sith
  8.robot</p>
  
  <p>My goal is to remove duplicates so that it prints:</p>
  
  <ol>
  <li>jedi</li>
  <li>sith</li>
  <li>bounty hunter</li>
  <li>robot</li>
  </ol>
  
  <p>If I change one of the jedi to "something jedi.", it will not print "something jedi."</p>
  
  <p>Output should be:</p>
  
  <p>1.jedi
  2.sith
  3.bounty hunter
  4.robot
  5.something jedi</p>
  
  <p>Right now I am using this code to achieve the task of removing duplicates.</p>
  
  <pre><code>if (department.contains(departmentList.get(empName))){
  }
  else{
       department += j + ": " + departmentList.get(empName) + "\n";
       j++;
  }
  </code></pre>
  
  <p>I understand where the mistake is. Since I am using .contains(VARIABLE), when it checks "something jedi" it will find that the word JEDI is already there. therefore it returns true and it won't add it to the department. </p>