title: Scala - Implement round robin without mutable types
body: <p>I am currently trying to find my way into the world of Scala. Actually I am trying to implement a Round Robin strategy without mutable types.</p>
  
  <p>I have an Scala Object with an initial list of hosts and a method to get the next host.</p>
  
  <pre><code>Object RoundRobin { 
    val optHosts: Option[List[String]] = Option[List[String]]("host1", "host2") // get from Configfile later
    var hosts: List[String] = optHosts.getOrElse(List())
  
    def url: String = {
      hosts = hosts.tail ++ List(hosts.head)
      hosts(0)
    }
  
    def execute = ??? // do something with the next host
  
  }
  </code></pre>
  
  <p>I have read about immutable Queues in Scala but I don't really know how to solve this problem with immutable types. Somehow I would have to remember an index right? Is that one of the cases where it doesn't make sense to use immutable types?</p>