How to Zip Two Lists, of Which One Only Has One Element or More (Combine Elements One by One From Two List) : <p>Here is an example of two lists:</p>

<pre><code>scala&gt; val hosts = List("host1", "host2")
hosts: List[String] = List(host1, host2)

scala&gt; val ports = List("port1")
ports: List[String] = List(port1)
</code></pre>

<p>What I want to achieve is:</p>

<pre><code>scala&gt; hosts zip ports
List[(String, String)] = List((host1,port1), (host2,port1))
</code></pre>

<p>Result below is what I get, which may be expected but I am still in the process of learning. would appreciate any help. </p>

<pre><code>scala&gt; hosts zip ports
res20: List[(String, String)] = List((host1,port1))
</code></pre>

<p>Note: at least one element on each list any time but it varies. regardless I would like to achieve one by one pairing.</p>
