title: equivalent of Java LinkedHashSet in Swift
body: <p>In java we have:</p>
  
  <pre><code>private Set&lt;AutoComplete&gt; hashList = new LinkedHashSet&lt;&gt;();
  </code></pre>
  
  <p>and:</p>
  
  <pre><code>public class AutoComplete {
  
      private String name;
      private String id;
  
      //...geters and setters
  
      @Override
      public boolean equals(Object o) {
          if (o instanceof AutoComplete) {
              AutoComplete autoComplete = (AutoComplete) o;
              if (name.equals(autoComplete.name) &amp;&amp; id.equals(autoComplete.id))
                  return true;
          }
          return false;
      }
  
      @Override
      public int hashCode() {
          int hash = 17;
          int hashMultiplikator = 79;
          try {
              hash = hashMultiplikator * hash
                      + getId().hashCode();
          } catch (java.lang.Exception e) {
              e.printStackTrace();
              MLogger.logException("autocomplete id can't be null", e);
          }
          return hash;
      }
  </code></pre>
  
  <p>Then when you add items to <em>hashList</em> , duplicate values wont be allowed and list is sort.</p>
  
  <p>So my questions is how to do this in Swift?!</p>
  
  <p>I already saw <a href="https://stackoverflow.com/a/25739498/3472667">Does there exist within Swift's API an easy way to remove duplicate elements from an array?</a></p>
  
  <p>and when I pass array of AutoComplete to func uniq ,</p>
  
  <pre><code>var namesAndIds : [AutoComplete] = []
  </code></pre>
  
  <p>(for remove duplicates:)</p>
  
  <pre><code>namesAndIds.appendContentsOf(SingletonMappingContacts.sharedInstance.autoComplete)
  namesAndIds = uniq(namesAndIds)
  
  func uniq&lt;S : SequenceType, T : Hashable where S.Generator.Element == T&gt;(source: S) -&gt; [T] {
          var buffer = [T]()
          var added = Set&lt;T&gt;()
          for elem in source {
              if !added.contains(elem) {
                  buffer.append(elem)
                  added.insert(elem)
              }
          }
          return buffer
      }
  </code></pre>
  
  <p>I've got this :
  <em>value of type AutoComplete has no member elemet</em></p>
  
  <p>AutoComplete:</p>
  
  <pre><code>class AutoComplete{
      var id : String
      var name : String
      init(id: String,name: String) {
          self.name = name
          self.id = id
      }
  }
  </code></pre>