title: How to check there's duplicate value in array or not?
body: <pre><code>var arrEmails = NSMutableArray()
  arrEmails = ["a.a@gmail.com", "a.a1@gmail.com", "a.a@gmail.com", "b.b@gmail.com", "c.c@gmail.com", "a.a1@gmail.com"]
  </code></pre>
  
  <p>above is my Array and i want to check is there any duplicate value or not. and for that i write below code.</p>
  
  <pre><code>let set = NSCountedSet.init(array: arrEmails as! [Any])
          var duplicates: Int = 0
  
          for var object in set {
              if set.count(for: object) &gt; 1 {
                  duplicates = duplicates+1
              }
          }
  </code></pre>
  
  <p>but in above code, if array contains values like below than it returns me duplicates value 1.</p>
  
  <pre><code>arrEmails = ["a.a@gmail.com", "", "", "b.b@gmail.com", "", ""]
  </code></pre>
  
  <p>I don't want to remove duplicate value, i just want to check number of duplicate value in array.
  How can check? please help me out.</p>