title: Zip 2 kotlin lists by a class property
body: <p>Given the following person definitions:</p>
  <pre><code>open class Person(val name: String, val age: Int)
  object EmptyPerson:Person(&quot;&quot;, 0)
  </code></pre>
  <p>And the following data:</p>
  <pre><code>val left = listOf(Person(&quot;Tinky-winkey&quot;, 1), Person(&quot;lala&quot;, 2))
  val right = listOf(Person(&quot;Dipsy&quot;, 3), Person(&quot;Tinky-winkey&quot;, 4))
  </code></pre>
  <p>Is it possible to zip the<code>left</code> and <code>right</code> lists based on the name property to yields:</p>
  <pre><code>val result = listOf(
          Pair(Person(&quot;Tinky-winkey&quot;, 1), Person(&quot;Tinky-winkey&quot;, 4)),
          Pair(Person(&quot;lala&quot;, 2), EmptyPerson),
          Pair(EmptyPerson, Person(&quot;Dipsy&quot;, 3))
      )
  </code></pre>
  <p>In a way that keeps the left elements on the left side of the <code>pair()</code>.</p>
  <p>Something like <code>left.zipByProperty {right, p-&gt;p.name}</code></p>
  <p>Maybe zip is not the right way to go?</p>