title: How should I filter a set to another set in Kotlin
body: <p>I am trying to get to grips with Kotlin and functional programming and failing on a pretty simple exercise.  </p>
  
  <p>I'll modify this a little so as to make it not too obvious that it is from a specific online course but I'm just trying to get started really and not trying to fool anyone...</p>
  
  <p>I am working with 2 collections </p>
  
  <pre><code>data class Pet(val name: String)
  
  data class Household (
     val pet: Pet,
     ... 
  )
  
  data class District(
     val allPets: Set&lt;Pet&gt;,
     val allHouseholds: List&lt;Household&gt;,
     ...)
  </code></pre>
  
  <p>I want to find all pets not in a household.  It has to be returned as a Set
  as I have been given this signature to play with </p>
  
  <pre><code>fun Locality.findFeralPets(): Set&lt;Pet&gt; =
  </code></pre>
  
  <p>I was going to do a filter operation but this returns a list and I can't see how to convert this to a set.  Can anyone point me in the right direction ?  It is very possible that filter is the wrong approach altogether!</p>
  
  <pre><code>allPets.filter { pet -&gt; pet.name != "Bob" }
  </code></pre>