title: Remove all duplicate and the original elements from a list
body: <p>I have a list of sObject elements. I want to remove the duplicate element having the same record name along with the original record .</p>
  
  <p>Like suppose if I have a list of element having record names as 
  Chair1,Chair2,Chair3,Chair4,Chair5,Chair6,Chair7,Chair1,Chair2</p>
  
  <p>I want to print a list having only the elements that have no duplicates.For this case I should get the list Chair3,Chair4,Chair5,Chair6,Chair7.</p>
  
  <p>I am using the below code to achieve this functionality.But I am getting thw records as : Chair1,Chair2,Chair3,Chair4,Chair5,Chair6,Chair7.</p>
  
  <p>In ideal case we should not get the records Chair1,Chair2 as these already have duplicate records.</p>
  
  <pre><code>List &lt;Chair__c&gt; chairList = [SELECT
                               ID,
                               Name
                               FROM Chair__c
                               ORDER BY Name ASC];
  System.debug('chairListOrderbyName::'+chairList);
  
  List &lt;String&gt; chairNameList = new List &lt;String&gt;();
  
  for(Integer i = 0; i &lt; chairList.size();i++) {
  
      for(Integer j = 0;j &lt; chairList.size();j++) {
  
      if(chairList[i].Name.equalsIgnoreCase(chairList[j].Name) &amp;&amp; i != j) {
  
          chairList.remove(i);
          chairList.remove(j);
      }
  }
  }
  System.debug('chairList::'+chairList);
  </code></pre>