title: Observable distinctUntilChanged returns duplicates
body: <p>Setup: <code>RxSwift 4.2</code> <code>Swift 4.1</code> <code>Xcode 9.4.1</code></p>
  
  <p>I'm currently using <code>distinctUntilChanged</code> to get unique values.
  But in my case it's only working for "sorted" values.</p>
  
  <p>Like for example here:</p>
  
  <pre><code>func unique(source: Observable&lt;Int&gt;) -&gt; Observable&lt;Int&gt; {
      return source.distinctUntilChanged()
  }
  </code></pre>
  
  <p>Here is the corresponding test:</p>
  
  <pre><code>func testUnique() {
      let input = Observable.from([1,2,3,4,4,5,4])
      let expectation = [Recorded.next(0, 1),
                         Recorded.next(0, 2),
                         Recorded.next(0, 3),
                         Recorded.next(0, 4),
                         Recorded.next(0, 5),
                         Recorded.completed(0)]
  
      _ = Class().unique(source: input).subscribe(observer)
  
      XCTAssertEqual(observer.events, expectation)
  }
  </code></pre>
  
  <p>And my test is failing with:</p>
  
  <pre><code>XCTAssertEqual failed: ("[next(1) @ 0, next(2) @ 0, next(3) @ 0, next(4) @ 0, next(5) @ 0, next(4) @ 0, completed @ 0]")
  is not equal to ("[next(1) @ 0, next(2) @ 0, next(3) @ 0, next(4) @ 0, next(5) @ 0, completed @ 0]") - 
  </code></pre>
  
  <p>So the last <code>4</code> is a duplicate.<br>
  Is this behavior expected or a bug?</p>