title: How to access an object's method for each object in a set?
body: <p>I'm new to Kotlin and I'm trying to figure out how to access each object's method of objects stored in a collection. For example:</p>
  
  <pre><code>open class Book(val title: String, val author: String) {
      companion object BookConstants {
          const val BASE_URL = "https://kbooks.co/"
      }
      open fun buildBookUrl(): String {
          return "$BASE_URL$title.html"
      }
  }
  
  fun main(args: Array&lt;String&gt;) {
      val allBooks = setOf&lt;Book&gt;(Book("Book Title 1", "Author 1"),
          Book("Book Title 2", "Author 2"),
          Book("Book Title 3", "Author 3"))
  
      //CODE HERE to access each book in `allBooks` set and call `buildBookUrl()` on it to get each custom url string
  
  
  }
  </code></pre>